<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MTB CAT1 Peripheral driver library: Functions</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="IFXCYP_one-line.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">MTB CAT1 Peripheral driver library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__group__cryptolite__lld__asymmetric__functions.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Functions<div class="ingroups"><a class="el" href="group__group__cryptolite.html">Cryptolite   (Cryptography)</a> &raquo; <a class="el" href="group__group__cryptolite__lld__asymmetric.html">Asymmetric Key Algorithm (RSA,ECP,ECDSA,EDDSA)</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:gafdf03c51442ff5e88b6b19bb4b7ec28c"><td class="memItemLeft" align="right" valign="top"><a id="gafdf03c51442ff5e88b6b19bb4b7ec28c"></a>
typedef <a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__cryptolite__lld__asymmetric__functions.html#gafdf03c51442ff5e88b6b19bb4b7ec28c">cy_cryptolite_ed25519_sha512_init_t</a>) (void *context)</td></tr>
<tr class="memdesc:gafdf03c51442ff5e88b6b19bb4b7ec28c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to a sha initialization function. <br /></td></tr>
<tr class="separator:gafdf03c51442ff5e88b6b19bb4b7ec28c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa4679df6ed15d5d6f1f465124bee09cc"><td class="memItemLeft" align="right" valign="top"><a id="gaa4679df6ed15d5d6f1f465124bee09cc"></a>
typedef <a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__cryptolite__lld__asymmetric__functions.html#gaa4679df6ed15d5d6f1f465124bee09cc">cy_cryptolite_ed25519_sha512_update_t</a>) (void *context, uint8_t const *input, uint32_t inputSize)</td></tr>
<tr class="memdesc:gaa4679df6ed15d5d6f1f465124bee09cc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to a sha update function. <br /></td></tr>
<tr class="separator:gaa4679df6ed15d5d6f1f465124bee09cc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga0d14f9b46c20ef7d69679fef91aefeef"><td class="memItemLeft" align="right" valign="top"><a id="ga0d14f9b46c20ef7d69679fef91aefeef"></a>
typedef <a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__cryptolite__lld__asymmetric__functions.html#ga0d14f9b46c20ef7d69679fef91aefeef">cy_cryptolite_ed25519_sha512_start_t</a>) (void *context)</td></tr>
<tr class="memdesc:ga0d14f9b46c20ef7d69679fef91aefeef"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to a sha start function. <br /></td></tr>
<tr class="separator:ga0d14f9b46c20ef7d69679fef91aefeef"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5fde282bff76e1649bcaafd992c0a549"><td class="memItemLeft" align="right" valign="top"><a id="ga5fde282bff76e1649bcaafd992c0a549"></a>
typedef <a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__cryptolite__lld__asymmetric__functions.html#ga5fde282bff76e1649bcaafd992c0a549">cy_cryptolite_ed25519_sha512_finish_t</a>) (void *context, uint8_t *output)</td></tr>
<tr class="memdesc:ga5fde282bff76e1649bcaafd992c0a549"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to a sha output function. <br /></td></tr>
<tr class="separator:ga5fde282bff76e1649bcaafd992c0a549"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaf14f955ab143879a414a7a31aff76aa7"><td class="memItemLeft" align="right" valign="top"><a id="gaf14f955ab143879a414a7a31aff76aa7"></a>
typedef <a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__cryptolite__lld__asymmetric__functions.html#gaf14f955ab143879a414a7a31aff76aa7">cy_cryptolite_ed25519_sha512_free_t</a>) (void *context)</td></tr>
<tr class="memdesc:gaf14f955ab143879a414a7a31aff76aa7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to a sha deinitialization function. <br /></td></tr>
<tr class="separator:gaf14f955ab143879a414a7a31aff76aa7"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga88dab061e7565107ca587bbb1d74dcc0"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__cryptolite__lld__asymmetric__functions.html#ga88dab061e7565107ca587bbb1d74dcc0">Cy_Cryptolite_ECC_Init</a> (CRYPTOLITE_Type *base, <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *cfContext, <a class="el" href="structcy__stc__cryptolite__ecc__buffer__t.html">cy_stc_cryptolite_ecc_buffer_t</a> *eccBuffer)</td></tr>
<tr class="memdesc:ga88dab061e7565107ca587bbb1d74dcc0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Init ECC Context.  <a href="#ga88dab061e7565107ca587bbb1d74dcc0">More...</a><br /></td></tr>
<tr class="separator:ga88dab061e7565107ca587bbb1d74dcc0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga123c9a912668b999845d7619737969f0"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__cryptolite__lld__asymmetric__functions.html#ga123c9a912668b999845d7619737969f0">Cy_Cryptolite_ECC_Free</a> (CRYPTOLITE_Type *base, <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *cfContext)</td></tr>
<tr class="memdesc:ga123c9a912668b999845d7619737969f0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Clean up ECC Context.  <a href="#ga123c9a912668b999845d7619737969f0">More...</a><br /></td></tr>
<tr class="separator:ga123c9a912668b999845d7619737969f0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac4780ed621723923232888685a8389a9"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__cryptolite__lld__asymmetric__functions.html#gac4780ed621723923232888685a8389a9">Cy_Cryptolite_ECC_SignHash</a> (CRYPTOLITE_Type *base, <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *cfContext, const uint8_t *hash, uint32_t hashlen, uint8_t *sig, const <a class="el" href="structcy__stc__cryptolite__ecc__key.html">cy_stc_cryptolite_ecc_key</a> *key, const uint8_t *messageKey)</td></tr>
<tr class="memdesc:gac4780ed621723923232888685a8389a9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Function to generate an ECC signature.  <a href="#gac4780ed621723923232888685a8389a9">More...</a><br /></td></tr>
<tr class="separator:gac4780ed621723923232888685a8389a9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga956dd70a876047166b391430eb7d1c58"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__cryptolite__lld__asymmetric__functions.html#ga956dd70a876047166b391430eb7d1c58">Cy_Cryptolite_ECC_VerifyHash</a> (CRYPTOLITE_Type *base, <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *cfContext, const uint8_t *sig, uint32_t siglen, const uint8_t *hash, uint32_t hashlen, <a class="el" href="group__group__cryptolite__enums.html#gafc6e4a5cca26d2fe19ba6d8c3429a4df">cy_en_cryptolite_sig_verify_result_t</a> *stat, const <a class="el" href="structcy__stc__cryptolite__ecc__key.html">cy_stc_cryptolite_ecc_key</a> *key)</td></tr>
<tr class="memdesc:ga956dd70a876047166b391430eb7d1c58"><td class="mdescLeft">&#160;</td><td class="mdescRight">Verify an ECC signature.  <a href="#ga956dd70a876047166b391430eb7d1c58">More...</a><br /></td></tr>
<tr class="separator:ga956dd70a876047166b391430eb7d1c58"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga9ce421065ec73beb963ed06298726e91"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__cryptolite__lld__asymmetric__functions.html#ga9ce421065ec73beb963ed06298726e91">Cy_Cryptolite_ECC_SharedSecret</a> (CRYPTOLITE_Type *base, <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *cfContext, <a class="el" href="group__group__cryptolite__enums.html#ga3b051ef176b1e1a9811acbae28eb2360">cy_en_cryptolite_ecc_curve_id_t</a> curveID, const uint8_t *privateKey, const <a class="el" href="structcy__stc__cryptolite__ecc__key.html">cy_stc_cryptolite_ecc_key</a> *key, uint8_t const *sharedSecret)</td></tr>
<tr class="memdesc:ga9ce421065ec73beb963ed06298726e91"><td class="mdescLeft">&#160;</td><td class="mdescRight">Generate a Shared Secret key from one private key and others public key.  <a href="#ga9ce421065ec73beb963ed06298726e91">More...</a><br /></td></tr>
<tr class="separator:ga9ce421065ec73beb963ed06298726e91"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga03448216ebbb2734e3e4e8f7f529bef5"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__cryptolite__lld__asymmetric__functions.html#ga03448216ebbb2734e3e4e8f7f529bef5">Cy_Cryptolite_ED25519_Init</a> (CRYPTOLITE_Type *base, <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *cfContext, <a class="el" href="structcy__stc__cryptolite__ecc__buffer__t.html">cy_stc_cryptolite_ecc_buffer_t</a> *eccBuffer, <a class="el" href="structcy__stc__cryptolite__ed25519__sha512__t.html">cy_stc_cryptolite_ed25519_sha512_t</a> *shaFunctions)</td></tr>
<tr class="memdesc:ga03448216ebbb2734e3e4e8f7f529bef5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Init ED25519 Context.  <a href="#ga03448216ebbb2734e3e4e8f7f529bef5">More...</a><br /></td></tr>
<tr class="separator:ga03448216ebbb2734e3e4e8f7f529bef5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga67493f2f433700b504e285bb9c441e14"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__cryptolite__lld__asymmetric__functions.html#ga67493f2f433700b504e285bb9c441e14">Cy_Cryptolite_ED25519_Free</a> (CRYPTOLITE_Type *base, <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *cfContext)</td></tr>
<tr class="memdesc:ga67493f2f433700b504e285bb9c441e14"><td class="mdescLeft">&#160;</td><td class="mdescRight">Free ED25519 Context.  <a href="#ga67493f2f433700b504e285bb9c441e14">More...</a><br /></td></tr>
<tr class="separator:ga67493f2f433700b504e285bb9c441e14"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga29c1a7ef06306d435299906f9cf40cbc"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__cryptolite__lld__asymmetric__functions.html#ga29c1a7ef06306d435299906f9cf40cbc">Cy_Cryptolite_ED25519_Sign</a> (CRYPTOLITE_Type *base, <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *cfContext, const uint8_t *hash, uint32_t hashlen, uint8_t *sig, const <a class="el" href="structcy__stc__cryptolite__ecc__key.html">cy_stc_cryptolite_ecc_key</a> *key, <a class="el" href="group__group__cryptolite__enums.html#gafa2003583345983638b3326bd52f22cd">cy_en_cryptolite_eddsa_sig_type_t</a> sigType, const uint8_t *sigctx, uint32_t sigctx_len)</td></tr>
<tr class="memdesc:ga29c1a7ef06306d435299906f9cf40cbc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sign a message.  <a href="#ga29c1a7ef06306d435299906f9cf40cbc">More...</a><br /></td></tr>
<tr class="separator:ga29c1a7ef06306d435299906f9cf40cbc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3735e882a1dd88dec12cbd5be9514921"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__cryptolite__lld__asymmetric__functions.html#ga3735e882a1dd88dec12cbd5be9514921">Cy_Cryptolite_ED25519_PointMultiplication</a> (CRYPTOLITE_Type *base, <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *cfContext, const uint8_t *ecpGX, const uint8_t *ecpGY, const uint8_t *ecpD, uint8_t *ecpQX, uint8_t *ecpQY)</td></tr>
<tr class="memdesc:ga3735e882a1dd88dec12cbd5be9514921"><td class="mdescLeft">&#160;</td><td class="mdescRight">Edwards 25519 elliptic curve point multiplication in GF(p).  <a href="#ga3735e882a1dd88dec12cbd5be9514921">More...</a><br /></td></tr>
<tr class="separator:ga3735e882a1dd88dec12cbd5be9514921"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga87ebcde6d856c570808beb799987e174"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__cryptolite__lld__asymmetric__functions.html#ga87ebcde6d856c570808beb799987e174">Cy_Cryptolite_ED25519_PointDecode</a> (CRYPTOLITE_Type *base, <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *cfContext, const uint8_t *publicKey, uint8_t *pubKey_x, uint8_t *pubKey_y)</td></tr>
<tr class="memdesc:ga87ebcde6d856c570808beb799987e174"><td class="mdescLeft">&#160;</td><td class="mdescRight">Decode ED25519 encoded public key in to x and y.  <a href="#ga87ebcde6d856c570808beb799987e174">More...</a><br /></td></tr>
<tr class="separator:ga87ebcde6d856c570808beb799987e174"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5528eb2740efe02150020148a4a06d09"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__cryptolite__lld__asymmetric__functions.html#ga5528eb2740efe02150020148a4a06d09">Cy_Cryptolite_ED25519_Verify</a> (CRYPTOLITE_Type *base, <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *cfContext, uint8_t *sig, const uint8_t *hash, uint32_t hashlen, const <a class="el" href="structcy__stc__cryptolite__ecc__key.html">cy_stc_cryptolite_ecc_key</a> *key, uint32_t *stat, <a class="el" href="group__group__cryptolite__enums.html#gafa2003583345983638b3326bd52f22cd">cy_en_cryptolite_eddsa_sig_type_t</a> sigType, const uint8_t *sigctx, uint32_t sigctx_len)</td></tr>
<tr class="memdesc:ga5528eb2740efe02150020148a4a06d09"><td class="mdescLeft">&#160;</td><td class="mdescRight">Verify ED25519 signed message.  <a href="#ga5528eb2740efe02150020148a4a06d09">More...</a><br /></td></tr>
<tr class="separator:ga5528eb2740efe02150020148a4a06d09"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad23cb5ab0498b2541505588d2cf8dc9d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__cryptolite__lld__asymmetric__functions.html#gad23cb5ab0498b2541505588d2cf8dc9d">Cy_Cryptolite_ED25519_MakePublicKey</a> (CRYPTOLITE_Type *base, <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *cfContext, const uint8_t *privateKey, <a class="el" href="structcy__stc__cryptolite__ecc__key.html">cy_stc_cryptolite_ecc_key</a> *publicKey)</td></tr>
<tr class="memdesc:gad23cb5ab0498b2541505588d2cf8dc9d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Make a new ED25519 public key.  <a href="#gad23cb5ab0498b2541505588d2cf8dc9d">More...</a><br /></td></tr>
<tr class="separator:gad23cb5ab0498b2541505588d2cf8dc9d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad1f2fa8d05fc6f027e2a5e97f5f8da7b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__cryptolite__lld__asymmetric__functions.html#gad1f2fa8d05fc6f027e2a5e97f5f8da7b">Cy_Cryptolite_EC25519_MakePublicKey</a> (CRYPTOLITE_Type *base, <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *cfContext, const uint8_t *privateKey, <a class="el" href="structcy__stc__cryptolite__ecc__key.html">cy_stc_cryptolite_ecc_key</a> *publicKey)</td></tr>
<tr class="memdesc:gad1f2fa8d05fc6f027e2a5e97f5f8da7b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Make a new EC25519 public key.  <a href="#gad1f2fa8d05fc6f027e2a5e97f5f8da7b">More...</a><br /></td></tr>
<tr class="separator:gad1f2fa8d05fc6f027e2a5e97f5f8da7b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga89f96810eb66b9a83bae673cb279ac6b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__cryptolite__lld__asymmetric__functions.html#ga89f96810eb66b9a83bae673cb279ac6b">Cy_Cryptolite_EC25519_MakePrivateKey</a> (CRYPTOLITE_Type *base, <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *cfContext, uint8_t *privateKey, <a class="el" href="group__group__crypto__lld__asymmetric__functions.html#gafb50caadc8ad53e03011d523e49cf022">cy_func_get_random_data_t</a> GetRandomDataFunc, void *randomDataInfo)</td></tr>
<tr class="memdesc:ga89f96810eb66b9a83bae673cb279ac6b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Make a new EC25519 private key.  <a href="#ga89f96810eb66b9a83bae673cb279ac6b">More...</a><br /></td></tr>
<tr class="separator:ga89f96810eb66b9a83bae673cb279ac6b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga60c4e3a7ccbdd45250001ee8e3078545"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__cryptolite__lld__asymmetric__functions.html#ga60c4e3a7ccbdd45250001ee8e3078545">Cy_Cryptolite_EC25519_PointMultiplication</a> (CRYPTOLITE_Type *base, <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *cfContext, uint8_t *p_r, const uint8_t *p_x, const uint8_t *p_d)</td></tr>
<tr class="memdesc:ga60c4e3a7ccbdd45250001ee8e3078545"><td class="mdescLeft">&#160;</td><td class="mdescRight">EC25519 Elliptic curve point multiplication in GF(p).  <a href="#ga60c4e3a7ccbdd45250001ee8e3078545">More...</a><br /></td></tr>
<tr class="separator:ga60c4e3a7ccbdd45250001ee8e3078545"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga9e98470af0fe0cd1150107725e79faff"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__cryptolite__lld__asymmetric__functions.html#ga9e98470af0fe0cd1150107725e79faff">Cy_Cryptolite_Rsa_Init</a> (CRYPTOLITE_Type *base, <a class="el" href="structcy__stc__cryptolite__context__rsa__t.html">cy_stc_cryptolite_context_rsa_t</a> *cfContext, <a class="el" href="structcy__stc__cryptolite__rsa__buffer__t.html">cy_stc_cryptolite_rsa_buffer_t</a> *rsaBuffers)</td></tr>
<tr class="memdesc:ga9e98470af0fe0cd1150107725e79faff"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize the RSA context.  <a href="#ga9e98470af0fe0cd1150107725e79faff">More...</a><br /></td></tr>
<tr class="separator:ga9e98470af0fe0cd1150107725e79faff"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga935311182a513548ec08fe3602a61145"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__cryptolite__lld__asymmetric__functions.html#ga935311182a513548ec08fe3602a61145">Cy_Cryptolite_Rsa_Proc</a> (CRYPTOLITE_Type *base, <a class="el" href="structcy__stc__cryptolite__context__rsa__t.html">cy_stc_cryptolite_context_rsa_t</a> *cfContext, <a class="el" href="structcy__stc__cryptolite__rsa__pub__key__t.html">cy_stc_cryptolite_rsa_pub_key_t</a> *key, uint8_t const *message, uint32_t messageSize, uint8_t *processedMessage)</td></tr>
<tr class="memdesc:ga935311182a513548ec08fe3602a61145"><td class="mdescLeft">&#160;</td><td class="mdescRight">RSA process algorithm based on the Montgomery algorithm using Barrett reduction.  <a href="#ga935311182a513548ec08fe3602a61145">More...</a><br /></td></tr>
<tr class="separator:ga935311182a513548ec08fe3602a61145"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gabb3cb1f3c4cc065655d752e833a10211"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__cryptolite__lld__asymmetric__functions.html#gabb3cb1f3c4cc065655d752e833a10211">Cy_Cryptolite_Rsa_Coef</a> (CRYPTOLITE_Type *base, <a class="el" href="structcy__stc__cryptolite__context__rsa__t.html">cy_stc_cryptolite_context_rsa_t</a> *cfContext, <a class="el" href="structcy__stc__cryptolite__rsa__pub__key__t.html">cy_stc_cryptolite_rsa_pub_key_t</a> *key)</td></tr>
<tr class="memdesc:gabb3cb1f3c4cc065655d752e833a10211"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculation constant coefficients to speed-up Montgomery algorithm.  <a href="#gabb3cb1f3c4cc065655d752e833a10211">More...</a><br /></td></tr>
<tr class="separator:gabb3cb1f3c4cc065655d752e833a10211"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad9679d4c527d03c5dc1e2f4f8476ca16"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__cryptolite__lld__asymmetric__functions.html#gad9679d4c527d03c5dc1e2f4f8476ca16">Cy_Cryptolite_Rsa_Free</a> (CRYPTOLITE_Type *base, <a class="el" href="structcy__stc__cryptolite__context__rsa__t.html">cy_stc_cryptolite_context_rsa_t</a> *cfContext)</td></tr>
<tr class="memdesc:gad9679d4c527d03c5dc1e2f4f8476ca16"><td class="mdescLeft">&#160;</td><td class="mdescRight">Cleanup the RSA context.  <a href="#gad9679d4c527d03c5dc1e2f4f8476ca16">More...</a><br /></td></tr>
<tr class="separator:gad9679d4c527d03c5dc1e2f4f8476ca16"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga30e087a8a09210e4bf99aefdf5ade151"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__cryptolite__lld__asymmetric__functions.html#ga30e087a8a09210e4bf99aefdf5ade151">Cy_Cryptolite_Rsa_Verify</a> (CRYPTOLITE_Type *base, <a class="el" href="structcy__stc__cryptolite__context__rsa__t.html">cy_stc_cryptolite_context_rsa_t</a> *cfContext, <a class="el" href="group__group__cryptolite__enums.html#gafc6e4a5cca26d2fe19ba6d8c3429a4df">cy_en_cryptolite_sig_verify_result_t</a> *verResult, <a class="el" href="group__group__cryptolite__enums.html#ga9dfc40ba7980b0b0d82fcd4ceef4647f">cy_en_cryptolite_sha_mode_t</a> digestType, uint8_t const *digest, uint32_t digestLength, uint8_t const *decryptedSignature, uint32_t decryptedSignatureLength)</td></tr>
<tr class="memdesc:ga30e087a8a09210e4bf99aefdf5ade151"><td class="mdescLeft">&#160;</td><td class="mdescRight">RSA verification with checks for content, paddings and signature format.  <a href="#ga30e087a8a09210e4bf99aefdf5ade151">More...</a><br /></td></tr>
<tr class="separator:ga30e087a8a09210e4bf99aefdf5ade151"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga88dab061e7565107ca587bbb1d74dcc0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga88dab061e7565107ca587bbb1d74dcc0">&#9670;&nbsp;</a></span>Cy_Cryptolite_ECC_Init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> Cy_Cryptolite_ECC_Init </td>
          <td>(</td>
          <td class="paramtype">CRYPTOLITE_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *&#160;</td>
          <td class="paramname"><em>cfContext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__ecc__buffer__t.html">cy_stc_cryptolite_ecc_buffer_t</a> *&#160;</td>
          <td class="paramname"><em>eccBuffer</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Init ECC Context. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>The pointer to a Cryptolite instance.</td></tr>
    <tr><td class="paramname">cfContext</td><td>The pointer to the <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html" title="Structure defines a ecdsa context. ">cy_stc_cryptolite_context_ecdsa_t</a>.</td></tr>
    <tr><td class="paramname">eccBuffer</td><td>The pointer to the <a class="el" href="structcy__stc__cryptolite__ecc__buffer__t.html" title="Structure defines a ecdsa context buffers must be aligned to 4 byte boundary. ">cy_stc_cryptolite_ecc_buffer_t</a>.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status code. See <a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>.</dd></dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line"></div><div class="line">    <a class="code" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> status = <a class="code" href="group__group__cryptolite__enums.html#ggafaeb3f2fb88784222220aee907e36710a57cc5b1b494c182a9beaccd987d0a03d">CY_CRYPTOLITE_BAD_PARAMS</a>;</div><div class="line">    <a class="code" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> sig_ctx;</div><div class="line">    <a class="code" href="structcy__stc__cryptolite__ecc__key.html">cy_stc_cryptolite_ecc_key</a> key;</div><div class="line">    <a class="code" href="group__group__cryptolite__enums.html#gafc6e4a5cca26d2fe19ba6d8c3429a4df">cy_en_cryptolite_sig_verify_result_t</a> verResult;</div><div class="line">    <a class="code" href="structcy__stc__cryptolite__ecc__buffer__t.html">cy_stc_cryptolite_ecc_buffer_t</a> ecdsa_buf;</div><div class="line"></div><div class="line">    uint8_t ecc_p256_signature[] = {</div><div class="line">    0x0f, 0x8c, 0x19, 0xf5, 0xaf, 0xfe, 0xa6, 0xd5, 0x93, 0xa3, 0x3e, 0x17, 0x6a, 0xa5, 0x27, 0x17,</div><div class="line">    0xbf, 0xf8, 0xd5, 0x87, 0x51, 0x65, 0xfc, 0x63, 0xe8, 0x0a, 0x2d, 0x65, 0x58, 0x0d, 0x29, 0x57,</div><div class="line">    0x89, 0xdb, 0x5f, 0xfb, 0x53, 0x97, 0xba, 0x4c, 0x67, 0x83, 0x4e, 0x27, 0x31, 0xee, 0x26, 0x8e,</div><div class="line">    0xa6, 0xf7, 0xe8, 0x38, 0x46, 0xfb, 0xb0, 0x21, 0x45, 0xb3, 0x54, 0x42, 0xdb, 0x18, 0xcf, 0x0b };</div><div class="line"></div><div class="line">    uint8_t hash_256[] =  {</div><div class="line">    0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23,</div><div class="line">    0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad };</div><div class="line"></div><div class="line">    uint8_t ecc_p256_public_key[] = {</div><div class="line">    0xde, 0xa5, 0xe4, 0x5d, 0x0e, 0xa3, 0x7f, 0xc5, 0x66, 0x23, 0x2a, 0x50, 0x8f, 0x4a, 0xd2, 0x0e,</div><div class="line">    0xa1, 0x3d, 0x47, 0xe4, 0xbf, 0x5f, 0xa4, 0xd5, 0x4a, 0x57, 0xa0, 0xba, 0x01, 0x20, 0x42, 0x08,</div><div class="line">    0x70, 0x97, 0x49, 0x6e, 0xfc, 0x58, 0x3f, 0xed, 0x8b, 0x24, 0xa5, 0xb9, 0xbe, 0x9a, 0x51, 0xde,</div><div class="line">    0x06, 0x3f, 0x5a, 0x00, 0xa8, 0xb6, 0x98, 0xa1, 0x6f, 0xd7, 0xf2, 0x9b, 0x54, 0x85, 0xf3, 0x20};</div><div class="line"></div><div class="line">    memset(&amp;key, 0, <span class="keyword">sizeof</span>(key));</div><div class="line">    memset(&amp;sig_ctx, 0, <span class="keyword">sizeof</span>(sig_ctx));</div><div class="line"></div><div class="line">    verResult = <a class="code" href="group__group__cryptolite__enums.html#ggafc6e4a5cca26d2fe19ba6d8c3429a4dfa353581c237f64d4bdceb04a44b156cd0">CY_CRYPTOLITE_SIG_INVALID</a>;</div><div class="line">    key.<a class="code" href="structcy__stc__cryptolite__ecc__key.html#a91cbc89befa5026100477d377be699ee">type</a> = PK_PUBLIC;</div><div class="line">    key.<a class="code" href="structcy__stc__cryptolite__ecc__key.html#ade76ac3957dc70b28991dd23bb7a5d99">curveID</a> = CY_CRYPTOLITE_ECC_ECP_SECP256R1;</div><div class="line">    key.<a class="code" href="structcy__stc__cryptolite__ecc__key.html#a3188e682de56a635385b997f4f6fe677">pubkey</a>.<a class="code" href="structcy__stc__cryptolite__ecc__point.html#aedbd6c954ab2fb19aac7f79c5403313a">x</a> = (<span class="keywordtype">void</span> *)ecc_p256_public_key;</div><div class="line">    key.<a class="code" href="structcy__stc__cryptolite__ecc__key.html#a3188e682de56a635385b997f4f6fe677">pubkey</a>.<a class="code" href="structcy__stc__cryptolite__ecc__point.html#a0bc996bae7233d396d2521f34ebeb4f1">y</a> = (<span class="keywordtype">void</span> *)(ecc_p256_public_key +  <span class="keyword">sizeof</span>(ecc_p256_public_key)/2);</div><div class="line"></div><div class="line">    Cy_Cryptolite_InvertEndianness(key.<a class="code" href="structcy__stc__cryptolite__ecc__key.html#a3188e682de56a635385b997f4f6fe677">pubkey</a>.<a class="code" href="structcy__stc__cryptolite__ecc__point.html#aedbd6c954ab2fb19aac7f79c5403313a">x</a>, <span class="keyword">sizeof</span>(ecc_p256_public_key)/2);</div><div class="line">    Cy_Cryptolite_InvertEndianness(key.<a class="code" href="structcy__stc__cryptolite__ecc__key.html#a3188e682de56a635385b997f4f6fe677">pubkey</a>.<a class="code" href="structcy__stc__cryptolite__ecc__point.html#a0bc996bae7233d396d2521f34ebeb4f1">y</a>, <span class="keyword">sizeof</span>(ecc_p256_public_key)/2);</div><div class="line"></div><div class="line">    Cy_Cryptolite_InvertEndianness(hash_256, <span class="keyword">sizeof</span>(hash_256));</div><div class="line"></div><div class="line">    Cy_Cryptolite_InvertEndianness(ecc_p256_signature, <span class="keyword">sizeof</span>(ecc_p256_signature)/2);</div><div class="line">    Cy_Cryptolite_InvertEndianness(ecc_p256_signature + <span class="keyword">sizeof</span>(ecc_p256_signature)/2, <span class="keyword">sizeof</span>(ecc_p256_signature)/2);</div><div class="line"></div><div class="line">    status = <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga88dab061e7565107ca587bbb1d74dcc0">Cy_Cryptolite_ECC_Init</a>(CRYPTOLITE,&amp;sig_ctx, &amp;ecdsa_buf);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div><div class="line">    status = <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga956dd70a876047166b391430eb7d1c58">Cy_Cryptolite_ECC_VerifyHash</a>(CRYPTOLITE, &amp;sig_ctx, ecc_p256_signature, <span class="keyword">sizeof</span>(ecc_p256_signature), hash_256, <span class="keyword">sizeof</span>(hash_256), &amp;verResult, &amp;key);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div><div class="line">    status =  <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga123c9a912668b999845d7619737969f0">Cy_Cryptolite_ECC_Free</a>(CRYPTOLITE, &amp;sig_ctx);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors &amp; verResult to be CY_CRYPTOLITE_SIG_VALID... */</span></div><div class="line"></div></div><!-- fragment --></dd></dl>

</div>
</div>
<a id="ga123c9a912668b999845d7619737969f0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga123c9a912668b999845d7619737969f0">&#9670;&nbsp;</a></span>Cy_Cryptolite_ECC_Free()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> Cy_Cryptolite_ECC_Free </td>
          <td>(</td>
          <td class="paramtype">CRYPTOLITE_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *&#160;</td>
          <td class="paramname"><em>cfContext</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Clean up ECC Context. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>The pointer to a Cryptolite instance.</td></tr>
    <tr><td class="paramname">cfContext</td><td>The pointer to the <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html" title="Structure defines a ecdsa context. ">cy_stc_cryptolite_context_ecdsa_t</a>.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status code. See <a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>.</dd></dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line"></div><div class="line">    <a class="code" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> status = <a class="code" href="group__group__cryptolite__enums.html#ggafaeb3f2fb88784222220aee907e36710a57cc5b1b494c182a9beaccd987d0a03d">CY_CRYPTOLITE_BAD_PARAMS</a>;</div><div class="line">    <a class="code" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> sig_ctx;</div><div class="line">    <a class="code" href="structcy__stc__cryptolite__ecc__key.html">cy_stc_cryptolite_ecc_key</a> key;</div><div class="line">    <a class="code" href="group__group__cryptolite__enums.html#gafc6e4a5cca26d2fe19ba6d8c3429a4df">cy_en_cryptolite_sig_verify_result_t</a> verResult;</div><div class="line">    <a class="code" href="structcy__stc__cryptolite__ecc__buffer__t.html">cy_stc_cryptolite_ecc_buffer_t</a> ecdsa_buf;</div><div class="line"></div><div class="line">    uint8_t ecc_p256_signature[] = {</div><div class="line">    0x0f, 0x8c, 0x19, 0xf5, 0xaf, 0xfe, 0xa6, 0xd5, 0x93, 0xa3, 0x3e, 0x17, 0x6a, 0xa5, 0x27, 0x17,</div><div class="line">    0xbf, 0xf8, 0xd5, 0x87, 0x51, 0x65, 0xfc, 0x63, 0xe8, 0x0a, 0x2d, 0x65, 0x58, 0x0d, 0x29, 0x57,</div><div class="line">    0x89, 0xdb, 0x5f, 0xfb, 0x53, 0x97, 0xba, 0x4c, 0x67, 0x83, 0x4e, 0x27, 0x31, 0xee, 0x26, 0x8e,</div><div class="line">    0xa6, 0xf7, 0xe8, 0x38, 0x46, 0xfb, 0xb0, 0x21, 0x45, 0xb3, 0x54, 0x42, 0xdb, 0x18, 0xcf, 0x0b };</div><div class="line"></div><div class="line">    uint8_t hash_256[] =  {</div><div class="line">    0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23,</div><div class="line">    0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad };</div><div class="line"></div><div class="line">    uint8_t ecc_p256_public_key[] = {</div><div class="line">    0xde, 0xa5, 0xe4, 0x5d, 0x0e, 0xa3, 0x7f, 0xc5, 0x66, 0x23, 0x2a, 0x50, 0x8f, 0x4a, 0xd2, 0x0e,</div><div class="line">    0xa1, 0x3d, 0x47, 0xe4, 0xbf, 0x5f, 0xa4, 0xd5, 0x4a, 0x57, 0xa0, 0xba, 0x01, 0x20, 0x42, 0x08,</div><div class="line">    0x70, 0x97, 0x49, 0x6e, 0xfc, 0x58, 0x3f, 0xed, 0x8b, 0x24, 0xa5, 0xb9, 0xbe, 0x9a, 0x51, 0xde,</div><div class="line">    0x06, 0x3f, 0x5a, 0x00, 0xa8, 0xb6, 0x98, 0xa1, 0x6f, 0xd7, 0xf2, 0x9b, 0x54, 0x85, 0xf3, 0x20};</div><div class="line"></div><div class="line">    memset(&amp;key, 0, <span class="keyword">sizeof</span>(key));</div><div class="line">    memset(&amp;sig_ctx, 0, <span class="keyword">sizeof</span>(sig_ctx));</div><div class="line"></div><div class="line">    verResult = <a class="code" href="group__group__cryptolite__enums.html#ggafc6e4a5cca26d2fe19ba6d8c3429a4dfa353581c237f64d4bdceb04a44b156cd0">CY_CRYPTOLITE_SIG_INVALID</a>;</div><div class="line">    key.<a class="code" href="structcy__stc__cryptolite__ecc__key.html#a91cbc89befa5026100477d377be699ee">type</a> = PK_PUBLIC;</div><div class="line">    key.<a class="code" href="structcy__stc__cryptolite__ecc__key.html#ade76ac3957dc70b28991dd23bb7a5d99">curveID</a> = CY_CRYPTOLITE_ECC_ECP_SECP256R1;</div><div class="line">    key.<a class="code" href="structcy__stc__cryptolite__ecc__key.html#a3188e682de56a635385b997f4f6fe677">pubkey</a>.<a class="code" href="structcy__stc__cryptolite__ecc__point.html#aedbd6c954ab2fb19aac7f79c5403313a">x</a> = (<span class="keywordtype">void</span> *)ecc_p256_public_key;</div><div class="line">    key.<a class="code" href="structcy__stc__cryptolite__ecc__key.html#a3188e682de56a635385b997f4f6fe677">pubkey</a>.<a class="code" href="structcy__stc__cryptolite__ecc__point.html#a0bc996bae7233d396d2521f34ebeb4f1">y</a> = (<span class="keywordtype">void</span> *)(ecc_p256_public_key +  <span class="keyword">sizeof</span>(ecc_p256_public_key)/2);</div><div class="line"></div><div class="line">    Cy_Cryptolite_InvertEndianness(key.<a class="code" href="structcy__stc__cryptolite__ecc__key.html#a3188e682de56a635385b997f4f6fe677">pubkey</a>.<a class="code" href="structcy__stc__cryptolite__ecc__point.html#aedbd6c954ab2fb19aac7f79c5403313a">x</a>, <span class="keyword">sizeof</span>(ecc_p256_public_key)/2);</div><div class="line">    Cy_Cryptolite_InvertEndianness(key.<a class="code" href="structcy__stc__cryptolite__ecc__key.html#a3188e682de56a635385b997f4f6fe677">pubkey</a>.<a class="code" href="structcy__stc__cryptolite__ecc__point.html#a0bc996bae7233d396d2521f34ebeb4f1">y</a>, <span class="keyword">sizeof</span>(ecc_p256_public_key)/2);</div><div class="line"></div><div class="line">    Cy_Cryptolite_InvertEndianness(hash_256, <span class="keyword">sizeof</span>(hash_256));</div><div class="line"></div><div class="line">    Cy_Cryptolite_InvertEndianness(ecc_p256_signature, <span class="keyword">sizeof</span>(ecc_p256_signature)/2);</div><div class="line">    Cy_Cryptolite_InvertEndianness(ecc_p256_signature + <span class="keyword">sizeof</span>(ecc_p256_signature)/2, <span class="keyword">sizeof</span>(ecc_p256_signature)/2);</div><div class="line"></div><div class="line">    status = <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga88dab061e7565107ca587bbb1d74dcc0">Cy_Cryptolite_ECC_Init</a>(CRYPTOLITE,&amp;sig_ctx, &amp;ecdsa_buf);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div><div class="line">    status = <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga956dd70a876047166b391430eb7d1c58">Cy_Cryptolite_ECC_VerifyHash</a>(CRYPTOLITE, &amp;sig_ctx, ecc_p256_signature, <span class="keyword">sizeof</span>(ecc_p256_signature), hash_256, <span class="keyword">sizeof</span>(hash_256), &amp;verResult, &amp;key);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div><div class="line">    status =  <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga123c9a912668b999845d7619737969f0">Cy_Cryptolite_ECC_Free</a>(CRYPTOLITE, &amp;sig_ctx);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors &amp; verResult to be CY_CRYPTOLITE_SIG_VALID... */</span></div><div class="line"></div></div><!-- fragment --></dd></dl>

</div>
</div>
<a id="gac4780ed621723923232888685a8389a9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gac4780ed621723923232888685a8389a9">&#9670;&nbsp;</a></span>Cy_Cryptolite_ECC_SignHash()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> Cy_Cryptolite_ECC_SignHash </td>
          <td>(</td>
          <td class="paramtype">CRYPTOLITE_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *&#160;</td>
          <td class="paramname"><em>cfContext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>hash</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>hashlen</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>sig</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structcy__stc__cryptolite__ecc__key.html">cy_stc_cryptolite_ecc_key</a> *&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>messageKey</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Function to generate an ECC signature. </p>
<p>key, hash and messageKey must be in little endian. Cy_Cryptolite_InvertEndianness() function is used for converting the endianness.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>The pointer to a Cryptolite instance.</td></tr>
    <tr><td class="paramname">cfContext</td><td>The pointer to the <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html" title="Structure defines a ecdsa context. ">cy_stc_cryptolite_context_ecdsa_t</a>.</td></tr>
    <tr><td class="paramname">hash</td><td>The hash (message digest) to be signed.</td></tr>
    <tr><td class="paramname">hashlen</td><td>The length of the hash (octets).</td></tr>
    <tr><td class="paramname">sig</td><td>The pointer to the buffer to store the generated signature 'R' followed by 'S'.</td></tr>
    <tr><td class="paramname">key</td><td>The private ECC key to sign the hash. See <a class="el" href="structcy__stc__cryptolite__ecc__key.html">cy_stc_cryptolite_ecc_key</a>.</td></tr>
    <tr><td class="paramname">messageKey</td><td>The random number for generating the signature.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status code. See <a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>. </dd></dl>

</div>
</div>
<a id="ga956dd70a876047166b391430eb7d1c58"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga956dd70a876047166b391430eb7d1c58">&#9670;&nbsp;</a></span>Cy_Cryptolite_ECC_VerifyHash()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> Cy_Cryptolite_ECC_VerifyHash </td>
          <td>(</td>
          <td class="paramtype">CRYPTOLITE_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *&#160;</td>
          <td class="paramname"><em>cfContext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>sig</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>siglen</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>hash</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>hashlen</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__cryptolite__enums.html#gafc6e4a5cca26d2fe19ba6d8c3429a4df">cy_en_cryptolite_sig_verify_result_t</a> *&#160;</td>
          <td class="paramname"><em>stat</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structcy__stc__cryptolite__ecc__key.html">cy_stc_cryptolite_ecc_key</a> *&#160;</td>
          <td class="paramname"><em>key</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Verify an ECC signature. </p>
<p>sig, hash and key must be in little endian. Cy_Cryptolite_InvertEndianness() function is used for converting the endianness.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>The pointer to a Cryptolite instance.</td></tr>
    <tr><td class="paramname">cfContext</td><td>The pointer to the ecdsa context.</td></tr>
    <tr><td class="paramname">sig</td><td>The signature to verify, 'R' followed by 'S'.</td></tr>
    <tr><td class="paramname">siglen</td><td>The length of signature.</td></tr>
    <tr><td class="paramname">hash</td><td>The hash (message digest) that was signed.</td></tr>
    <tr><td class="paramname">hashlen</td><td>The length of the hash (octets).</td></tr>
    <tr><td class="paramname">stat</td><td>Result of signature, 0xAAAAAAAA = invalid, 0x55555555 = valid.</td></tr>
    <tr><td class="paramname">key</td><td>The corresponding public ECC key. See <a class="el" href="structcy__stc__cryptolite__ecc__key.html">cy_stc_cryptolite_ecc_key</a>.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status code. See <a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>.</dd></dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line"></div><div class="line">    <a class="code" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> status = <a class="code" href="group__group__cryptolite__enums.html#ggafaeb3f2fb88784222220aee907e36710a57cc5b1b494c182a9beaccd987d0a03d">CY_CRYPTOLITE_BAD_PARAMS</a>;</div><div class="line">    <a class="code" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> sig_ctx;</div><div class="line">    <a class="code" href="structcy__stc__cryptolite__ecc__key.html">cy_stc_cryptolite_ecc_key</a> key;</div><div class="line">    <a class="code" href="group__group__cryptolite__enums.html#gafc6e4a5cca26d2fe19ba6d8c3429a4df">cy_en_cryptolite_sig_verify_result_t</a> verResult;</div><div class="line">    <a class="code" href="structcy__stc__cryptolite__ecc__buffer__t.html">cy_stc_cryptolite_ecc_buffer_t</a> ecdsa_buf;</div><div class="line"></div><div class="line">    uint8_t ecc_p256_signature[] = {</div><div class="line">    0x0f, 0x8c, 0x19, 0xf5, 0xaf, 0xfe, 0xa6, 0xd5, 0x93, 0xa3, 0x3e, 0x17, 0x6a, 0xa5, 0x27, 0x17,</div><div class="line">    0xbf, 0xf8, 0xd5, 0x87, 0x51, 0x65, 0xfc, 0x63, 0xe8, 0x0a, 0x2d, 0x65, 0x58, 0x0d, 0x29, 0x57,</div><div class="line">    0x89, 0xdb, 0x5f, 0xfb, 0x53, 0x97, 0xba, 0x4c, 0x67, 0x83, 0x4e, 0x27, 0x31, 0xee, 0x26, 0x8e,</div><div class="line">    0xa6, 0xf7, 0xe8, 0x38, 0x46, 0xfb, 0xb0, 0x21, 0x45, 0xb3, 0x54, 0x42, 0xdb, 0x18, 0xcf, 0x0b };</div><div class="line"></div><div class="line">    uint8_t hash_256[] =  {</div><div class="line">    0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23,</div><div class="line">    0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad };</div><div class="line"></div><div class="line">    uint8_t ecc_p256_public_key[] = {</div><div class="line">    0xde, 0xa5, 0xe4, 0x5d, 0x0e, 0xa3, 0x7f, 0xc5, 0x66, 0x23, 0x2a, 0x50, 0x8f, 0x4a, 0xd2, 0x0e,</div><div class="line">    0xa1, 0x3d, 0x47, 0xe4, 0xbf, 0x5f, 0xa4, 0xd5, 0x4a, 0x57, 0xa0, 0xba, 0x01, 0x20, 0x42, 0x08,</div><div class="line">    0x70, 0x97, 0x49, 0x6e, 0xfc, 0x58, 0x3f, 0xed, 0x8b, 0x24, 0xa5, 0xb9, 0xbe, 0x9a, 0x51, 0xde,</div><div class="line">    0x06, 0x3f, 0x5a, 0x00, 0xa8, 0xb6, 0x98, 0xa1, 0x6f, 0xd7, 0xf2, 0x9b, 0x54, 0x85, 0xf3, 0x20};</div><div class="line"></div><div class="line">    memset(&amp;key, 0, <span class="keyword">sizeof</span>(key));</div><div class="line">    memset(&amp;sig_ctx, 0, <span class="keyword">sizeof</span>(sig_ctx));</div><div class="line"></div><div class="line">    verResult = <a class="code" href="group__group__cryptolite__enums.html#ggafc6e4a5cca26d2fe19ba6d8c3429a4dfa353581c237f64d4bdceb04a44b156cd0">CY_CRYPTOLITE_SIG_INVALID</a>;</div><div class="line">    key.<a class="code" href="structcy__stc__cryptolite__ecc__key.html#a91cbc89befa5026100477d377be699ee">type</a> = PK_PUBLIC;</div><div class="line">    key.<a class="code" href="structcy__stc__cryptolite__ecc__key.html#ade76ac3957dc70b28991dd23bb7a5d99">curveID</a> = CY_CRYPTOLITE_ECC_ECP_SECP256R1;</div><div class="line">    key.<a class="code" href="structcy__stc__cryptolite__ecc__key.html#a3188e682de56a635385b997f4f6fe677">pubkey</a>.<a class="code" href="structcy__stc__cryptolite__ecc__point.html#aedbd6c954ab2fb19aac7f79c5403313a">x</a> = (<span class="keywordtype">void</span> *)ecc_p256_public_key;</div><div class="line">    key.<a class="code" href="structcy__stc__cryptolite__ecc__key.html#a3188e682de56a635385b997f4f6fe677">pubkey</a>.<a class="code" href="structcy__stc__cryptolite__ecc__point.html#a0bc996bae7233d396d2521f34ebeb4f1">y</a> = (<span class="keywordtype">void</span> *)(ecc_p256_public_key +  <span class="keyword">sizeof</span>(ecc_p256_public_key)/2);</div><div class="line"></div><div class="line">    Cy_Cryptolite_InvertEndianness(key.<a class="code" href="structcy__stc__cryptolite__ecc__key.html#a3188e682de56a635385b997f4f6fe677">pubkey</a>.<a class="code" href="structcy__stc__cryptolite__ecc__point.html#aedbd6c954ab2fb19aac7f79c5403313a">x</a>, <span class="keyword">sizeof</span>(ecc_p256_public_key)/2);</div><div class="line">    Cy_Cryptolite_InvertEndianness(key.<a class="code" href="structcy__stc__cryptolite__ecc__key.html#a3188e682de56a635385b997f4f6fe677">pubkey</a>.<a class="code" href="structcy__stc__cryptolite__ecc__point.html#a0bc996bae7233d396d2521f34ebeb4f1">y</a>, <span class="keyword">sizeof</span>(ecc_p256_public_key)/2);</div><div class="line"></div><div class="line">    Cy_Cryptolite_InvertEndianness(hash_256, <span class="keyword">sizeof</span>(hash_256));</div><div class="line"></div><div class="line">    Cy_Cryptolite_InvertEndianness(ecc_p256_signature, <span class="keyword">sizeof</span>(ecc_p256_signature)/2);</div><div class="line">    Cy_Cryptolite_InvertEndianness(ecc_p256_signature + <span class="keyword">sizeof</span>(ecc_p256_signature)/2, <span class="keyword">sizeof</span>(ecc_p256_signature)/2);</div><div class="line"></div><div class="line">    status = <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga88dab061e7565107ca587bbb1d74dcc0">Cy_Cryptolite_ECC_Init</a>(CRYPTOLITE,&amp;sig_ctx, &amp;ecdsa_buf);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div><div class="line">    status = <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga956dd70a876047166b391430eb7d1c58">Cy_Cryptolite_ECC_VerifyHash</a>(CRYPTOLITE, &amp;sig_ctx, ecc_p256_signature, <span class="keyword">sizeof</span>(ecc_p256_signature), hash_256, <span class="keyword">sizeof</span>(hash_256), &amp;verResult, &amp;key);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div><div class="line">    status =  <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga123c9a912668b999845d7619737969f0">Cy_Cryptolite_ECC_Free</a>(CRYPTOLITE, &amp;sig_ctx);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors &amp; verResult to be CY_CRYPTOLITE_SIG_VALID... */</span></div><div class="line"></div></div><!-- fragment --></dd></dl>

</div>
</div>
<a id="ga9ce421065ec73beb963ed06298726e91"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga9ce421065ec73beb963ed06298726e91">&#9670;&nbsp;</a></span>Cy_Cryptolite_ECC_SharedSecret()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> Cy_Cryptolite_ECC_SharedSecret </td>
          <td>(</td>
          <td class="paramtype">CRYPTOLITE_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *&#160;</td>
          <td class="paramname"><em>cfContext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__cryptolite__enums.html#ga3b051ef176b1e1a9811acbae28eb2360">cy_en_cryptolite_ecc_curve_id_t</a>&#160;</td>
          <td class="paramname"><em>curveID</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>privateKey</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structcy__stc__cryptolite__ecc__key.html">cy_stc_cryptolite_ecc_key</a> *&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t const *&#160;</td>
          <td class="paramname"><em>sharedSecret</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Generate a Shared Secret key from one private key and others public key. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>The pointer to a Cryptolite instance.</td></tr>
    <tr><td class="paramname">cfContext</td><td>The pointer to the <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html" title="Structure defines a ecdsa context. ">cy_stc_cryptolite_context_ecdsa_t</a>.</td></tr>
    <tr><td class="paramname">curveID</td><td>The ECC curve id.</td></tr>
    <tr><td class="paramname">privateKey</td><td>The pointer to the ECC private key.</td></tr>
    <tr><td class="paramname">key</td><td>The generated public ECC key. See <a class="el" href="structcy__stc__cryptolite__ecc__key.html">cy_stc_cryptolite_ecc_key</a>.</td></tr>
    <tr><td class="paramname">sharedSecret</td><td>The pointer to store the generated shared Secret.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status code. See <a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>. </dd></dl>

</div>
</div>
<a id="ga03448216ebbb2734e3e4e8f7f529bef5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga03448216ebbb2734e3e4e8f7f529bef5">&#9670;&nbsp;</a></span>Cy_Cryptolite_ED25519_Init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> Cy_Cryptolite_ED25519_Init </td>
          <td>(</td>
          <td class="paramtype">CRYPTOLITE_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *&#160;</td>
          <td class="paramname"><em>cfContext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__ecc__buffer__t.html">cy_stc_cryptolite_ecc_buffer_t</a> *&#160;</td>
          <td class="paramname"><em>eccBuffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__ed25519__sha512__t.html">cy_stc_cryptolite_ed25519_sha512_t</a> *&#160;</td>
          <td class="paramname"><em>shaFunctions</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Init ED25519 Context. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>The pointer to a Cryptolite instance.</td></tr>
    <tr><td class="paramname">cfContext</td><td>The pointer to the <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html" title="Structure defines a ecdsa context. ">cy_stc_cryptolite_context_ecdsa_t</a>.</td></tr>
    <tr><td class="paramname">eccBuffer</td><td>The pointer to the <a class="el" href="structcy__stc__cryptolite__ecc__buffer__t.html" title="Structure defines a ecdsa context buffers must be aligned to 4 byte boundary. ">cy_stc_cryptolite_ecc_buffer_t</a>.</td></tr>
    <tr><td class="paramname">shaFunctions</td><td>The pointer to the <a class="el" href="structcy__stc__cryptolite__ed25519__sha512__t.html" title="Structure defines a ed25519 sha function pointers. ">cy_stc_cryptolite_ed25519_sha512_t</a>.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status code. See <a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>. </dd></dl>

</div>
</div>
<a id="ga67493f2f433700b504e285bb9c441e14"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga67493f2f433700b504e285bb9c441e14">&#9670;&nbsp;</a></span>Cy_Cryptolite_ED25519_Free()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> Cy_Cryptolite_ED25519_Free </td>
          <td>(</td>
          <td class="paramtype">CRYPTOLITE_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *&#160;</td>
          <td class="paramname"><em>cfContext</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Free ED25519 Context. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>The pointer to a Cryptolite instance.</td></tr>
    <tr><td class="paramname">cfContext</td><td>The pointer to the <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html" title="Structure defines a ecdsa context. ">cy_stc_cryptolite_context_ecdsa_t</a>.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status code. See <a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>. </dd></dl>

</div>
</div>
<a id="ga29c1a7ef06306d435299906f9cf40cbc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga29c1a7ef06306d435299906f9cf40cbc">&#9670;&nbsp;</a></span>Cy_Cryptolite_ED25519_Sign()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> Cy_Cryptolite_ED25519_Sign </td>
          <td>(</td>
          <td class="paramtype">CRYPTOLITE_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *&#160;</td>
          <td class="paramname"><em>cfContext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>hash</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>hashlen</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>sig</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structcy__stc__cryptolite__ecc__key.html">cy_stc_cryptolite_ecc_key</a> *&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__cryptolite__enums.html#gafa2003583345983638b3326bd52f22cd">cy_en_cryptolite_eddsa_sig_type_t</a>&#160;</td>
          <td class="paramname"><em>sigType</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>sigctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>sigctx_len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sign a message. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>The pointer to a Cryptolite instance.</td></tr>
    <tr><td class="paramname">cfContext</td><td>The pointer to the <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html" title="Structure defines a ecdsa context. ">cy_stc_cryptolite_context_ecdsa_t</a>.</td></tr>
    <tr><td class="paramname">hash</td><td>The message to sign. Provided as is in data buffer. This is usually the hash of the original data to be signed.</td></tr>
    <tr><td class="paramname">hashlen</td><td>The length of the message in bytes.</td></tr>
    <tr><td class="paramname">sig</td><td>[out] The destination for the signature, 'r' followed by 's'.</td></tr>
    <tr><td class="paramname">key</td><td>Key (Little Endian) used for signature generation. See <a class="el" href="structcy__stc__cryptolite__ecc__key.html">cy_stc_cryptolite_ecc_key</a>.</td></tr>
    <tr><td class="paramname">sigType</td><td>signature Type. CY_CRYPTOLITE_EDDSA_PURE,CY_CRYPTOLITE_EDDSA_CTX or CY_CRYPTOLITE_EDDSA_PREHASH</td></tr>
    <tr><td class="paramname">sigctx</td><td>signature context. can be NULL if EDDSA_PURE is used or if no context is provided.</td></tr>
    <tr><td class="paramname">sigctx_len</td><td>The length of the signature context</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status code. See <a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>.</dd></dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line"></div><div class="line">    <a class="code" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> crypto_status;</div><div class="line">    <a class="code" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> cfContext;</div><div class="line">    <a class="code" href="structcy__stc__cryptolite__ecc__buffer__t.html">cy_stc_cryptolite_ecc_buffer_t</a> eccBuffer;</div><div class="line">    <a class="code" href="structcy__stc__cryptolite__ed25519__sha512__t.html">cy_stc_cryptolite_ed25519_sha512_t</a> shaFunctions;</div><div class="line"></div><div class="line">    mbedtls_sha512_context g_512ctx;</div><div class="line"></div><div class="line">    <span class="comment">/* message and Key are treated big-endian and sig generated as little-endian</span></div><div class="line"><span class="comment">      sig(R,S) = ed25519_sign(key,msg)</span></div><div class="line"><span class="comment">    */</span></div><div class="line">    CY_ALIGN(4) <a class="code" href="structcy__stc__cryptolite__ecc__key.html">cy_stc_cryptolite_ecc_key</a> myKey;</div><div class="line">    CY_ALIGN(4) uint8_t sign_msg[CY_CRYPTOLITE_ECC_ED25519_BYTE_SIZE*2] = {0};</div><div class="line">    CY_ALIGN(4) uint8_t msg[] = {0x05,0x04,0x03,0x02,0x01};</div><div class="line"></div><div class="line">    <span class="comment">/* */</span></div><div class="line">    CY_ALIGN(4) uint8_t prvKey[CY_CRYPTOLITE_ECC_ED25519_BYTE_SIZE] =</div><div class="line">    {</div><div class="line">        0x9d, 0x61, 0xb1, 0x9d, 0xef, 0xfd, 0x5a, 0x60, 0xba, 0x84,</div><div class="line">        0x4a, 0xf4, 0x92, 0xec, 0x2c, 0xc4, 0x44, 0x49, 0xc5, 0x69,</div><div class="line">        0x7b, 0x32, 0x69, 0x19, 0x70, 0x3b, 0xac, 0x03, 0x1c, 0xae,</div><div class="line">        0x7f, 0x60</div><div class="line">    };</div><div class="line"></div><div class="line">    CY_ALIGN(4) uint8_t pubKey[CY_CRYPTOLITE_ECC_ED25519_BYTE_SIZE*2] = {0};</div><div class="line"></div><div class="line">    myKey.<a class="code" href="structcy__stc__cryptolite__ecc__key.html#ade76ac3957dc70b28991dd23bb7a5d99">curveID</a> = CY_CRYPTOLITE_ECC_ECP_ED25519;</div><div class="line">    myKey.type = PK_PRIVATE;</div><div class="line">    myKey.k = prvKey;</div><div class="line">    myKey.pubkey.x = &amp;pubKey[0];</div><div class="line">    myKey.pubkey.y = &amp;pubKey[CY_CRYPTOLITE_ECC_ED25519_BYTE_SIZE];</div><div class="line"></div><div class="line">    uint8_t *msg_ptr = msg;</div><div class="line">    uint32_t msg_size = <span class="keyword">sizeof</span>(msg);</div><div class="line"></div><div class="line">    <span class="keyword">static</span> <span class="keyword">const</span> uint8_t publicKey[CY_CRYPTOLITE_ECC_ED25519_BYTE_SIZE] =</div><div class="line">    {</div><div class="line">        0xD7,0x5A,0x98,0x01,0x82,0xB1,0x0A,0xB7,0xD5,0x4B,0xFE,0xD3,</div><div class="line">        0xC9, 0x64, 0x07, 0x3A, 0x0E, 0xE1, 0x72, 0xF3, 0xDA, 0xA6,</div><div class="line">        0x23, 0x25, 0xAF, 0x02, 0x1A, 0x68, 0xF7, 0x07, 0x51, 0x1A</div><div class="line">    };</div><div class="line"></div><div class="line"></div><div class="line">    <span class="comment">/* Initialize user defined sha512 function pointers */</span></div><div class="line">    shaFunctions.<a class="code" href="structcy__stc__cryptolite__ed25519__sha512__t.html#a7e9d26c6b6455d6a1ffced346ea3c5d6">shactx</a> = &amp;g_512ctx;</div><div class="line">    shaFunctions.<a class="code" href="structcy__stc__cryptolite__ed25519__sha512__t.html#a5739a818ac0e8bbcf2f496fb0fda6077">sha_init</a> = hook_sha512_init;</div><div class="line">    shaFunctions.<a class="code" href="structcy__stc__cryptolite__ed25519__sha512__t.html#a32d575e60d8c16cbf4e774ff05579515">sha_start</a> = hook_sha512_start;</div><div class="line">    shaFunctions.<a class="code" href="structcy__stc__cryptolite__ed25519__sha512__t.html#a09fa0dcec4a228d28589d84f99b39c0b">sha_update</a> = hook_sha512_update;</div><div class="line">    shaFunctions.<a class="code" href="structcy__stc__cryptolite__ed25519__sha512__t.html#a3c2cb4a271cccffaffc76e3be8f25ad1">sha_finish</a> = hook_sha512_finish;</div><div class="line">    shaFunctions.<a class="code" href="structcy__stc__cryptolite__ed25519__sha512__t.html#ab015bc837e9c38898ed4bfa821aaf719">sha_free</a> = hook_sha512_free;</div><div class="line"></div><div class="line">    <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga03448216ebbb2734e3e4e8f7f529bef5">Cy_Cryptolite_ED25519_Init</a>(CRYPTOLITE, &amp;cfContext, &amp;eccBuffer, &amp;shaFunctions);</div><div class="line"></div><div class="line">    <span class="comment">/* public key decode test*/</span></div><div class="line">    crypto_status = <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga87ebcde6d856c570808beb799987e174">Cy_Cryptolite_ED25519_PointDecode</a>(CRYPTOLITE, &amp;cfContext, publicKey, myKey.pubkey.x, myKey.pubkey.y);</div><div class="line"></div><div class="line">    <span class="comment">/* Generate Pub Key Test*/</span></div><div class="line">    <span class="comment">/* private key expected in big-endian */</span></div><div class="line">    crypto_status = <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#gad23cb5ab0498b2541505588d2cf8dc9d">Cy_Cryptolite_ED25519_MakePublicKey</a>(CRYPTOLITE, &amp;cfContext, prvKey, &amp;myKey);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div><div class="line">    <span class="comment">/* CY_CRYPTOLITE_EDDSA_PURE*/</span></div><div class="line">    <span class="comment">/* Public Key should be in little Endian */</span></div><div class="line">    crypto_status = <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga29c1a7ef06306d435299906f9cf40cbc">Cy_Cryptolite_ED25519_Sign</a>(CRYPTOLITE, &amp;cfContext, msg_ptr, msg_size, sign_msg, &amp;myKey, <a class="code" href="group__group__cryptolite__enums.html#ggafa2003583345983638b3326bd52f22cda1d3d8a51eefa2bfd866b57a88b7e20ca">CY_CRYPTOLITE_EDDSA_PURE</a>, NULL, 0);</div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div><div class="line">    <span class="comment">/* Verify signatures */</span></div><div class="line">    uint32_t stat = 0;</div><div class="line">    <span class="comment">/* PURE Verify*/</span></div><div class="line">    msg_ptr = msg;</div><div class="line">    msg_size = <span class="keyword">sizeof</span>(msg);</div><div class="line"></div><div class="line">    crypto_status = <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga5528eb2740efe02150020148a4a06d09">Cy_Cryptolite_ED25519_Verify</a>(CRYPTOLITE, &amp;cfContext, sign_msg, msg_ptr, msg_size, &amp;myKey, &amp;stat, <a class="code" href="group__group__cryptolite__enums.html#ggafa2003583345983638b3326bd52f22cda1d3d8a51eefa2bfd866b57a88b7e20ca">CY_CRYPTOLITE_EDDSA_PURE</a>, NULL, 0);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div></div><!-- fragment --></dd></dl>

</div>
</div>
<a id="ga3735e882a1dd88dec12cbd5be9514921"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga3735e882a1dd88dec12cbd5be9514921">&#9670;&nbsp;</a></span>Cy_Cryptolite_ED25519_PointMultiplication()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> Cy_Cryptolite_ED25519_PointMultiplication </td>
          <td>(</td>
          <td class="paramtype">CRYPTOLITE_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *&#160;</td>
          <td class="paramname"><em>cfContext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>ecpGX</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>ecpGY</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>ecpD</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>ecpQX</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>ecpQY</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Edwards 25519 elliptic curve point multiplication in GF(p). </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>The pointer to a Cryptolite instance.</td></tr>
    <tr><td class="paramname">cfContext</td><td>The pointer to the <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html" title="Structure defines a ecdsa context. ">cy_stc_cryptolite_context_ecdsa_t</a>.</td></tr>
    <tr><td class="paramname">ecpGX</td><td>X coordinate of base point.</td></tr>
    <tr><td class="paramname">ecpGY</td><td>Y coordinate of base point.</td></tr>
    <tr><td class="paramname">ecpD</td><td>multiplication scalar value.</td></tr>
    <tr><td class="paramname">ecpQX</td><td>X coordinate of result point.</td></tr>
    <tr><td class="paramname">ecpQY</td><td>Y coordinate of result point.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status code. See <a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>. </dd></dl>

</div>
</div>
<a id="ga87ebcde6d856c570808beb799987e174"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga87ebcde6d856c570808beb799987e174">&#9670;&nbsp;</a></span>Cy_Cryptolite_ED25519_PointDecode()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> Cy_Cryptolite_ED25519_PointDecode </td>
          <td>(</td>
          <td class="paramtype">CRYPTOLITE_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *&#160;</td>
          <td class="paramname"><em>cfContext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>publicKey</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>pubKey_x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>pubKey_y</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Decode ED25519 encoded public key in to x and y. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>The pointer to a Cryptolite instance.</td></tr>
    <tr><td class="paramname">cfContext</td><td>The pointer to the <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html" title="Structure defines a ecdsa context. ">cy_stc_cryptolite_context_ecdsa_t</a>.</td></tr>
    <tr><td class="paramname">publicKey</td><td>[in] encoded 32 byte Public key.</td></tr>
    <tr><td class="paramname">pubKey_x</td><td>[out] Decoded 32 bytes Public key x in little-endian format.</td></tr>
    <tr><td class="paramname">pubKey_y</td><td>[out] Decoded 32 bytes Public key y in little-endian format.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status code. See <a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>. </dd></dl>

</div>
</div>
<a id="ga5528eb2740efe02150020148a4a06d09"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga5528eb2740efe02150020148a4a06d09">&#9670;&nbsp;</a></span>Cy_Cryptolite_ED25519_Verify()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> Cy_Cryptolite_ED25519_Verify </td>
          <td>(</td>
          <td class="paramtype">CRYPTOLITE_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *&#160;</td>
          <td class="paramname"><em>cfContext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>sig</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>hash</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>hashlen</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structcy__stc__cryptolite__ecc__key.html">cy_stc_cryptolite_ecc_key</a> *&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t *&#160;</td>
          <td class="paramname"><em>stat</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__cryptolite__enums.html#gafa2003583345983638b3326bd52f22cd">cy_en_cryptolite_eddsa_sig_type_t</a>&#160;</td>
          <td class="paramname"><em>sigType</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>sigctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>sigctx_len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Verify ED25519 signed message. </p>
<p>On successful verification, CY_CRYPTOLITE_SUCCESS is returned and stat is 0xA1A1A1A1.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>The pointer to a Cryptolite instance.</td></tr>
    <tr><td class="paramname">cfContext</td><td>The pointer to the <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html" title="Structure defines a ecdsa context. ">cy_stc_cryptolite_context_ecdsa_t</a>.</td></tr>
    <tr><td class="paramname">sig</td><td>The signature to verify, 'R' followed by 'S'.</td></tr>
    <tr><td class="paramname">hash</td><td>The hash or message that was signed.</td></tr>
    <tr><td class="paramname">hashlen</td><td>The length of the hash or message (octets).</td></tr>
    <tr><td class="paramname">stat</td><td>Result of signature verification, 0xA1A1A1A1==valid, 0x00BADBAD==invalid.</td></tr>
    <tr><td class="paramname">key</td><td>The corresponding uncompressed public key to use (little-endian). See <a class="el" href="structcy__stc__cryptolite__ecc__key.html">cy_stc_cryptolite_ecc_key</a>.</td></tr>
    <tr><td class="paramname">sigType</td><td>signature Type. CY_CRYPTOLITE_EDDSA_PURE,CY_CRYPTOLITE_EDDSA_CTX or CY_CRYPTOLITE_EDDSA_PREHASH</td></tr>
    <tr><td class="paramname">sigctx</td><td>signature context. can be NULL if EDDSA_PURE is used or if no context is provided.</td></tr>
    <tr><td class="paramname">sigctx_len</td><td>The length of the signature context</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status code. See <a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>.</dd></dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line"></div><div class="line">    <a class="code" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> crypto_status;</div><div class="line">    <a class="code" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> cfContext;</div><div class="line">    <a class="code" href="structcy__stc__cryptolite__ecc__buffer__t.html">cy_stc_cryptolite_ecc_buffer_t</a> eccBuffer;</div><div class="line">    <a class="code" href="structcy__stc__cryptolite__ed25519__sha512__t.html">cy_stc_cryptolite_ed25519_sha512_t</a> shaFunctions;</div><div class="line"></div><div class="line">    mbedtls_sha512_context g_512ctx;</div><div class="line"></div><div class="line">    <span class="comment">/* message and Key are treated big-endian and sig generated as little-endian</span></div><div class="line"><span class="comment">      sig(R,S) = ed25519_sign(key,msg)</span></div><div class="line"><span class="comment">    */</span></div><div class="line">    CY_ALIGN(4) <a class="code" href="structcy__stc__cryptolite__ecc__key.html">cy_stc_cryptolite_ecc_key</a> myKey;</div><div class="line">    CY_ALIGN(4) uint8_t sign_msg[CY_CRYPTOLITE_ECC_ED25519_BYTE_SIZE*2] = {0};</div><div class="line">    CY_ALIGN(4) uint8_t msg[] = {0x05,0x04,0x03,0x02,0x01};</div><div class="line"></div><div class="line">    <span class="comment">/* */</span></div><div class="line">    CY_ALIGN(4) uint8_t prvKey[CY_CRYPTOLITE_ECC_ED25519_BYTE_SIZE] =</div><div class="line">    {</div><div class="line">        0x9d, 0x61, 0xb1, 0x9d, 0xef, 0xfd, 0x5a, 0x60, 0xba, 0x84,</div><div class="line">        0x4a, 0xf4, 0x92, 0xec, 0x2c, 0xc4, 0x44, 0x49, 0xc5, 0x69,</div><div class="line">        0x7b, 0x32, 0x69, 0x19, 0x70, 0x3b, 0xac, 0x03, 0x1c, 0xae,</div><div class="line">        0x7f, 0x60</div><div class="line">    };</div><div class="line"></div><div class="line">    CY_ALIGN(4) uint8_t pubKey[CY_CRYPTOLITE_ECC_ED25519_BYTE_SIZE*2] = {0};</div><div class="line"></div><div class="line">    myKey.<a class="code" href="structcy__stc__cryptolite__ecc__key.html#ade76ac3957dc70b28991dd23bb7a5d99">curveID</a> = CY_CRYPTOLITE_ECC_ECP_ED25519;</div><div class="line">    myKey.type = PK_PRIVATE;</div><div class="line">    myKey.k = prvKey;</div><div class="line">    myKey.pubkey.x = &amp;pubKey[0];</div><div class="line">    myKey.pubkey.y = &amp;pubKey[CY_CRYPTOLITE_ECC_ED25519_BYTE_SIZE];</div><div class="line"></div><div class="line">    uint8_t *msg_ptr = msg;</div><div class="line">    uint32_t msg_size = <span class="keyword">sizeof</span>(msg);</div><div class="line"></div><div class="line">    <span class="keyword">static</span> <span class="keyword">const</span> uint8_t publicKey[CY_CRYPTOLITE_ECC_ED25519_BYTE_SIZE] =</div><div class="line">    {</div><div class="line">        0xD7,0x5A,0x98,0x01,0x82,0xB1,0x0A,0xB7,0xD5,0x4B,0xFE,0xD3,</div><div class="line">        0xC9, 0x64, 0x07, 0x3A, 0x0E, 0xE1, 0x72, 0xF3, 0xDA, 0xA6,</div><div class="line">        0x23, 0x25, 0xAF, 0x02, 0x1A, 0x68, 0xF7, 0x07, 0x51, 0x1A</div><div class="line">    };</div><div class="line"></div><div class="line"></div><div class="line">    <span class="comment">/* Initialize user defined sha512 function pointers */</span></div><div class="line">    shaFunctions.<a class="code" href="structcy__stc__cryptolite__ed25519__sha512__t.html#a7e9d26c6b6455d6a1ffced346ea3c5d6">shactx</a> = &amp;g_512ctx;</div><div class="line">    shaFunctions.<a class="code" href="structcy__stc__cryptolite__ed25519__sha512__t.html#a5739a818ac0e8bbcf2f496fb0fda6077">sha_init</a> = hook_sha512_init;</div><div class="line">    shaFunctions.<a class="code" href="structcy__stc__cryptolite__ed25519__sha512__t.html#a32d575e60d8c16cbf4e774ff05579515">sha_start</a> = hook_sha512_start;</div><div class="line">    shaFunctions.<a class="code" href="structcy__stc__cryptolite__ed25519__sha512__t.html#a09fa0dcec4a228d28589d84f99b39c0b">sha_update</a> = hook_sha512_update;</div><div class="line">    shaFunctions.<a class="code" href="structcy__stc__cryptolite__ed25519__sha512__t.html#a3c2cb4a271cccffaffc76e3be8f25ad1">sha_finish</a> = hook_sha512_finish;</div><div class="line">    shaFunctions.<a class="code" href="structcy__stc__cryptolite__ed25519__sha512__t.html#ab015bc837e9c38898ed4bfa821aaf719">sha_free</a> = hook_sha512_free;</div><div class="line"></div><div class="line">    <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga03448216ebbb2734e3e4e8f7f529bef5">Cy_Cryptolite_ED25519_Init</a>(CRYPTOLITE, &amp;cfContext, &amp;eccBuffer, &amp;shaFunctions);</div><div class="line"></div><div class="line">    <span class="comment">/* public key decode test*/</span></div><div class="line">    crypto_status = <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga87ebcde6d856c570808beb799987e174">Cy_Cryptolite_ED25519_PointDecode</a>(CRYPTOLITE, &amp;cfContext, publicKey, myKey.pubkey.x, myKey.pubkey.y);</div><div class="line"></div><div class="line">    <span class="comment">/* Generate Pub Key Test*/</span></div><div class="line">    <span class="comment">/* private key expected in big-endian */</span></div><div class="line">    crypto_status = <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#gad23cb5ab0498b2541505588d2cf8dc9d">Cy_Cryptolite_ED25519_MakePublicKey</a>(CRYPTOLITE, &amp;cfContext, prvKey, &amp;myKey);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div><div class="line">    <span class="comment">/* CY_CRYPTOLITE_EDDSA_PURE*/</span></div><div class="line">    <span class="comment">/* Public Key should be in little Endian */</span></div><div class="line">    crypto_status = <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga29c1a7ef06306d435299906f9cf40cbc">Cy_Cryptolite_ED25519_Sign</a>(CRYPTOLITE, &amp;cfContext, msg_ptr, msg_size, sign_msg, &amp;myKey, <a class="code" href="group__group__cryptolite__enums.html#ggafa2003583345983638b3326bd52f22cda1d3d8a51eefa2bfd866b57a88b7e20ca">CY_CRYPTOLITE_EDDSA_PURE</a>, NULL, 0);</div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div><div class="line">    <span class="comment">/* Verify signatures */</span></div><div class="line">    uint32_t stat = 0;</div><div class="line">    <span class="comment">/* PURE Verify*/</span></div><div class="line">    msg_ptr = msg;</div><div class="line">    msg_size = <span class="keyword">sizeof</span>(msg);</div><div class="line"></div><div class="line">    crypto_status = <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga5528eb2740efe02150020148a4a06d09">Cy_Cryptolite_ED25519_Verify</a>(CRYPTOLITE, &amp;cfContext, sign_msg, msg_ptr, msg_size, &amp;myKey, &amp;stat, <a class="code" href="group__group__cryptolite__enums.html#ggafa2003583345983638b3326bd52f22cda1d3d8a51eefa2bfd866b57a88b7e20ca">CY_CRYPTOLITE_EDDSA_PURE</a>, NULL, 0);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div></div><!-- fragment --></dd></dl>

</div>
</div>
<a id="gad23cb5ab0498b2541505588d2cf8dc9d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad23cb5ab0498b2541505588d2cf8dc9d">&#9670;&nbsp;</a></span>Cy_Cryptolite_ED25519_MakePublicKey()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> Cy_Cryptolite_ED25519_MakePublicKey </td>
          <td>(</td>
          <td class="paramtype">CRYPTOLITE_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *&#160;</td>
          <td class="paramname"><em>cfContext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>privateKey</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__ecc__key.html">cy_stc_cryptolite_ecc_key</a> *&#160;</td>
          <td class="paramname"><em>publicKey</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Make a new ED25519 public key. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>The pointer to a Cryptolite instance.</td></tr>
    <tr><td class="paramname">cfContext</td><td>The pointer to the <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html" title="Structure defines a ecdsa context. ">cy_stc_cryptolite_context_ecdsa_t</a>.</td></tr>
    <tr><td class="paramname">privateKey</td><td>[in] Private key.</td></tr>
    <tr><td class="paramname">publicKey</td><td>[out] Newly created Public key. See <a class="el" href="structcy__stc__cryptolite__ecc__key.html">cy_stc_cryptolite_ecc_key</a>.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status code. See <a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>. </dd></dl>

</div>
</div>
<a id="gad1f2fa8d05fc6f027e2a5e97f5f8da7b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad1f2fa8d05fc6f027e2a5e97f5f8da7b">&#9670;&nbsp;</a></span>Cy_Cryptolite_EC25519_MakePublicKey()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> Cy_Cryptolite_EC25519_MakePublicKey </td>
          <td>(</td>
          <td class="paramtype">CRYPTOLITE_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *&#160;</td>
          <td class="paramname"><em>cfContext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>privateKey</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__ecc__key.html">cy_stc_cryptolite_ecc_key</a> *&#160;</td>
          <td class="paramname"><em>publicKey</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Make a new EC25519 public key. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>The pointer to a Cryptolite instance.</td></tr>
    <tr><td class="paramname">cfContext</td><td>The pointer to the <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html" title="Structure defines a ecdsa context. ">cy_stc_cryptolite_context_ecdsa_t</a>.</td></tr>
    <tr><td class="paramname">privateKey</td><td>[in] Private key.</td></tr>
    <tr><td class="paramname">publicKey</td><td>[out] Newly created Public key. See <a class="el" href="structcy__stc__cryptolite__ecc__key.html">cy_stc_cryptolite_ecc_key</a>.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status code. See <a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>. </dd></dl>

</div>
</div>
<a id="ga89f96810eb66b9a83bae673cb279ac6b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga89f96810eb66b9a83bae673cb279ac6b">&#9670;&nbsp;</a></span>Cy_Cryptolite_EC25519_MakePrivateKey()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> Cy_Cryptolite_EC25519_MakePrivateKey </td>
          <td>(</td>
          <td class="paramtype">CRYPTOLITE_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *&#160;</td>
          <td class="paramname"><em>cfContext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>privateKey</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__crypto__lld__asymmetric__functions.html#gafb50caadc8ad53e03011d523e49cf022">cy_func_get_random_data_t</a>&#160;</td>
          <td class="paramname"><em>GetRandomDataFunc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>randomDataInfo</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Make a new EC25519 private key. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>The pointer to a Cryptolite instance.</td></tr>
    <tr><td class="paramname">cfContext</td><td>The pointer to the <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html" title="Structure defines a ecdsa context. ">cy_stc_cryptolite_context_ecdsa_t</a>.</td></tr>
    <tr><td class="paramname">privateKey</td><td>[out] Destination of the newly created key.</td></tr>
    <tr><td class="paramname">GetRandomDataFunc</td><td>See <a class="el" href="group__group__crypto__lld__asymmetric__functions.html#gafb50caadc8ad53e03011d523e49cf022">cy_func_get_random_data_t</a>.</td></tr>
    <tr><td class="paramname">randomDataInfo</td><td>Argument for GetRandomDataFunc.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status code. See <a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>. </dd></dl>

</div>
</div>
<a id="ga60c4e3a7ccbdd45250001ee8e3078545"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga60c4e3a7ccbdd45250001ee8e3078545">&#9670;&nbsp;</a></span>Cy_Cryptolite_EC25519_PointMultiplication()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> Cy_Cryptolite_EC25519_PointMultiplication </td>
          <td>(</td>
          <td class="paramtype">CRYPTOLITE_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html">cy_stc_cryptolite_context_ecdsa_t</a> *&#160;</td>
          <td class="paramname"><em>cfContext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>p_r</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>p_x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>p_d</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>EC25519 Elliptic curve point multiplication in GF(p). </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>The pointer to a Cryptolite instance.</td></tr>
    <tr><td class="paramname">cfContext</td><td>The pointer to the <a class="el" href="structcy__stc__cryptolite__context__ecdsa__t.html" title="Structure defines a ecdsa context. ">cy_stc_cryptolite_context_ecdsa_t</a>.</td></tr>
    <tr><td class="paramname">p_r</td><td>Pointer to result point.</td></tr>
    <tr><td class="paramname">p_x</td><td>Pointer to X coordinate of base point.</td></tr>
    <tr><td class="paramname">p_d</td><td>Pointer to Scalar multiplication value.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status code. See <a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a>. </dd></dl>

</div>
</div>
<a id="ga9e98470af0fe0cd1150107725e79faff"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga9e98470af0fe0cd1150107725e79faff">&#9670;&nbsp;</a></span>Cy_Cryptolite_Rsa_Init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> Cy_Cryptolite_Rsa_Init </td>
          <td>(</td>
          <td class="paramtype">CRYPTOLITE_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__context__rsa__t.html">cy_stc_cryptolite_context_rsa_t</a> *&#160;</td>
          <td class="paramname"><em>cfContext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__rsa__buffer__t.html">cy_stc_cryptolite_rsa_buffer_t</a> *&#160;</td>
          <td class="paramname"><em>rsaBuffers</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initialize the RSA context. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>The pointer to the CRYPTOLITE instance.</td></tr>
    <tr><td class="paramname">cfContext</td><td>The pointer to the CRYPTOLITE context.</td></tr>
    <tr><td class="paramname">rsaBuffers</td><td>The pointer to the RSA buffers.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a></dd></dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line"></div><div class="line"></div><div class="line">    CY_ALIGN(4) uint8_t encryptedSignature_2048[] =</div><div class="line">    {</div><div class="line">        0x86, 0x1c, 0xf4, 0x97, 0xcc, 0xb0, 0xf9, 0x8e, 0xb1, 0x93, 0x20, 0x30, 0x5b, 0xe4, 0xe2, 0xf4,</div><div class="line">        0x30, 0x66, 0xa3, 0x6d, 0xe8, 0x74, 0x4f, 0xa9, 0xe9, 0xd1, 0x16, 0xc5, 0x17, 0xc0, 0x97, 0x1d,</div><div class="line">        0x60, 0x39, 0xb0, 0xda, 0xf4, 0x65, 0xad, 0x7e, 0x59, 0x6c, 0xce, 0x12, 0x29, 0x8b, 0x23, 0xdd,</div><div class="line">        0x4b, 0xb6, 0xd3, 0xb6, 0x7e, 0x2b, 0x5d, 0xae, 0x55, 0x5e, 0x43, 0xf3, 0x61, 0x8a, 0x8c, 0xbd,</div><div class="line">        0x47, 0x59, 0x05, 0x21, 0x4b, 0x54, 0x7b, 0x49, 0xd2, 0xbd, 0x33, 0xdb, 0x82, 0x5d, 0xfc, 0xb4,</div><div class="line">        0xf8, 0xcf, 0x37, 0x2d, 0x2f, 0x04, 0x76, 0x66, 0x0d, 0x16, 0xea, 0x28, 0xb3, 0xde, 0x40, 0x86,</div><div class="line">        0x8d, 0x83, 0x2d, 0xca, 0x6d, 0x5d, 0xac, 0xf5, 0x0e, 0x4f, 0xb3, 0xb3, 0x04, 0xb6, 0x91, 0x87,</div><div class="line">        0xab, 0xac, 0x1f, 0x2f, 0xdc, 0x50, 0xf5, 0x9d, 0x88, 0xe3, 0x20, 0x23, 0xcc, 0xb0, 0x8a, 0x1f,</div><div class="line">        0xf9, 0x7e, 0x08, 0xb0, 0x55, 0x3f, 0xf5, 0xa4, 0x86, 0x25, 0x77, 0x62, 0x7e, 0x51, 0x55, 0xe8,</div><div class="line">        0x1f, 0xd5, 0x24, 0xf5, 0xa8, 0x5a, 0x97, 0xb6, 0x0a, 0x8e, 0xe3, 0x65, 0x6d, 0xfd, 0xe3, 0xc6,</div><div class="line">        0xff, 0x1b, 0x32, 0x0d, 0xdb, 0x99, 0x55, 0x7b, 0x06, 0xd0, 0x98, 0xea, 0xae, 0xa9, 0xbc, 0xcd,</div><div class="line">        0xa1, 0x81, 0xad, 0x07, 0xc7, 0xd8, 0x4a, 0xa9, 0x6e, 0x3f, 0xc6, 0xdf, 0x7c, 0x12, 0xce, 0xb3,</div><div class="line">        0x8e, 0x5d, 0x30, 0x2b, 0xb8, 0x66, 0xf4, 0xf9, 0xc8, 0xa0, 0xcc, 0x83, 0x70, 0x46, 0x31, 0x3a,</div><div class="line">        0x98, 0x29, 0xae, 0x60, 0x38, 0x6f, 0xe2, 0x7e, 0xac, 0x5b, 0x8e, 0x15, 0xa0, 0x21, 0x00, 0x78,</div><div class="line">        0x72, 0x4c, 0x87, 0x70, 0x60, 0x6a, 0x23, 0x9a, 0x49, 0x7f, 0x93, 0xfd, 0x26, 0x3f, 0xb9, 0x3d,</div><div class="line">        0x3e, 0xa8, 0xfe, 0x0a, 0x0c, 0xc6, 0x67, 0x37, 0x19, 0x03, 0xdf, 0xe5, 0x4f, 0x6d, 0x03, 0x4d,</div><div class="line">    };</div><div class="line"></div><div class="line"></div><div class="line">    CY_ALIGN(4) uint8_t modulus_2048[] =</div><div class="line">    {</div><div class="line"></div><div class="line">    <span class="comment">/* Big endian format */</span></div><div class="line">        0xbf,0xbe,0x6e,0xc4,0x9e,0x76,0x9d,0x45,0xf9,0x17,0x32,0x9d,0x4a,0xa0,0xe4,0xf0,</div><div class="line">        0xf9,0x9f,0x02,0x6b,0xb2,0xcb,0x8a,0xe0,0x51,0xd4,0xea,0x7c,0x7c,0xdf,0xa2,0xa9,</div><div class="line">        0xa5,0x5a,0x64,0x42,0x76,0xcd,0x38,0x90,0x3d,0x42,0x91,0x3d,0x1b,0xc6,0x6c,0x80,</div><div class="line">        0xc6,0xd7,0x16,0xcb,0x93,0xfe,0x59,0x1f,0xa7,0x97,0x1f,0x57,0xd5,0x6b,0x33,0x53,</div><div class="line">        0xc8,0x54,0x7f,0xa6,0x4e,0xf8,0x26,0x7e,0x6e,0xd5,0x1f,0x78,0x31,0x32,0xdf,0xca,</div><div class="line">        0x82,0x39,0xb1,0x42,0x57,0xa8,0xa8,0x9f,0x93,0x4e,0x39,0x7b,0xa7,0xf0,0x39,0x61,</div><div class="line">        0x42,0x31,0x38,0xa2,0xff,0x05,0xf5,0x0d,0x06,0x0d,0x26,0x66,0xe5,0x71,0x6f,0x0d,</div><div class="line">        0x52,0x24,0x6f,0x4d,0x83,0x8e,0x97,0xda,0x88,0x91,0x41,0xe4,0x16,0x31,0x70,0x69,</div><div class="line">        0xea,0x3a,0x61,0x4f,0xb3,0x58,0x4c,0xc7,0xdd,0xf0,0x6a,0xd0,0x7b,0xa5,0x2c,0x47,</div><div class="line">        0x03,0x06,0x7a,0x31,0x8f,0xab,0xc7,0xca,0x73,0xc4,0xa9,0xe8,0x17,0xd3,0xff,0x2e,</div><div class="line">        0x2b,0x0d,0x60,0x48,0x5d,0x69,0x8a,0xa0,0xb4,0x8e,0x37,0xe9,0xf5,0x2d,0xb7,0x5f,</div><div class="line">        0xfd,0x27,0x2b,0x65,0x05,0xfc,0xab,0x43,0x43,0xdc,0x84,0x40,0x7f,0x1b,0x67,0x7d,</div><div class="line">        0x7e,0xc1,0xa7,0xf5,0x37,0xfa,0xb9,0xcd,0x56,0x7f,0xde,0xb3,0xb8,0x76,0x90,0xf4,</div><div class="line">        0x00,0x3b,0xcc,0x9b,0xb6,0xf8,0xec,0xbc,0x41,0x92,0x71,0xe3,0xe2,0xf3,0x0d,0xf9,</div><div class="line">        0xd7,0x7a,0x2a,0x27,0x3f,0x80,0xb3,0x98,0x9d,0x39,0xaa,0x10,0xdc,0x8b,0x6c,0x16,</div><div class="line">        0xca,0x97,0xef,0x55,0xd6,0x5f,0x18,0x89,0x61,0x0e,0x24,0xb9,0x11,0x4d,0x6e,0xc7</div><div class="line">    };</div><div class="line"></div><div class="line">    CY_ALIGN(4)  uint8_t plainTxt[] = &quot;abc&quot;;</div><div class="line"></div><div class="line">    CY_ALIGN(4) uint8_t publicExponent[] =</div><div class="line">    {</div><div class="line">    <span class="comment">/* This is a part of public key. (So called e)</span></div><div class="line"><span class="comment">    * Refer public_key.txt</span></div><div class="line"><span class="comment">    */</span></div><div class="line">    <span class="comment">/* Big endian format */</span></div><div class="line">        0x01, 0x00, 0x01</div><div class="line">    };</div><div class="line"></div><div class="line">    CY_ALIGN(4) uint8_t barretCoef[4*VU_BITS_TO_WORDS(CY_CRYPTOLITE_RSA_BITSIZE+1)]={0};  <span class="comment">/* Must be modulo length + 1 BITS */</span></div><div class="line">    CY_ALIGN(4) uint8_t inverseModulo[4*VU_BITS_TO_WORDS(CY_CRYPTOLITE_RSA_BITSIZE+1)]={0};    <span class="comment">/* Must be same as modulo length */</span></div><div class="line">    CY_ALIGN(4) uint8_t rBar[4*VU_BITS_TO_WORDS(CY_CRYPTOLITE_RSA_BITSIZE+1)]={0};             <span class="comment">/* Must be same as modulo length */</span></div><div class="line"></div><div class="line"></div><div class="line">    CY_ALIGN(4)uint8_t decryptedSignature[2048/8]={0};</div><div class="line">    CY_ALIGN(4) uint8_t calculatedHash[32]={0};</div><div class="line">    <a class="code" href="structcy__stc__cryptolite__rsa__buffer__t.html">cy_stc_cryptolite_rsa_buffer_t</a> rsa_buffer;</div><div class="line"></div><div class="line">    <a class="code" href="structcy__stc__cryptolite__context__rsa__t.html">cy_stc_cryptolite_context_rsa_t</a> rsa_ctx;</div><div class="line">    <a class="code" href="structcy__stc__cryptolite__context__sha256__t.html">cy_stc_cryptolite_context_sha256_t</a> sha_ctx;</div><div class="line">    <a class="code" href="group__group__cryptolite__enums.html#gafc6e4a5cca26d2fe19ba6d8c3429a4df">cy_en_cryptolite_sig_verify_result_t</a> verResult;</div><div class="line">    <a class="code" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> status;</div><div class="line"></div><div class="line">    verResult = <a class="code" href="group__group__cryptolite__enums.html#ggafc6e4a5cca26d2fe19ba6d8c3429a4dfa353581c237f64d4bdceb04a44b156cd0">CY_CRYPTOLITE_SIG_INVALID</a>;</div><div class="line">    memset((<span class="keywordtype">void</span>*)&amp;decryptedSignature, 0u, <span class="keyword">sizeof</span>(decryptedSignature));</div><div class="line">    memset((<span class="keywordtype">void</span>*)&amp;calculatedHash, 0u, <span class="keyword">sizeof</span>(calculatedHash));</div><div class="line">    memset((<span class="keywordtype">void</span>*)&amp;rsa_buffer, 0u, <span class="keyword">sizeof</span>(rsa_buffer));</div><div class="line">    memset((<span class="keywordtype">void</span>*)&amp;rsa_ctx, 0u, <span class="keyword">sizeof</span>(rsa_ctx));</div><div class="line">    memset((<span class="keywordtype">void</span>*)&amp;sha_ctx, 0u, <span class="keyword">sizeof</span>(sha_ctx));</div><div class="line"></div><div class="line">    Cy_Cryptolite_InvertEndianness(modulus_2048, 2048u/8 );</div><div class="line">    Cy_Cryptolite_InvertEndianness(encryptedSignature_2048, <span class="keyword">sizeof</span>(encryptedSignature_2048) );</div><div class="line"></div><div class="line">    Cy_Cryptolite_InvertEndianness(publicExponent, <span class="keyword">sizeof</span>(publicExponent));</div><div class="line"></div><div class="line">    <a class="code" href="structcy__stc__cryptolite__rsa__pub__key__t.html">cy_stc_cryptolite_rsa_pub_key_t</a> pubKeyPtr =</div><div class="line">    {</div><div class="line">        .<a class="code" href="structcy__stc__cryptolite__rsa__pub__key__t.html#af693adcbc706181816a873bf82107f87">moduloPtr</a>          = modulus_2048,</div><div class="line">        .moduloLength       = 2048u,</div><div class="line">        .pubExpPtr          = publicExponent,</div><div class="line">        .pubExpLength       = <span class="keyword">sizeof</span>(publicExponent)* 8,       <span class="comment">/* 17 bits */</span></div><div class="line">        .barretCoefPtr       = barretCoef,</div><div class="line">        .inverseModuloPtr    = inverseModulo,</div><div class="line">        .rBarPtr             = rBar,</div><div class="line">        .preCalculatedCoeff  = <span class="keyword">false</span></div><div class="line">    };</div><div class="line"></div><div class="line">    status = <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga9e98470af0fe0cd1150107725e79faff">Cy_Cryptolite_Rsa_Init</a>(CRYPTOLITE, &amp;rsa_ctx, &amp;rsa_buffer);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div><div class="line">    <span class="comment">/* At first decrypt the received signature. */</span></div><div class="line">    status = <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga935311182a513548ec08fe3602a61145">Cy_Cryptolite_Rsa_Proc</a>(CRYPTOLITE, &amp;rsa_ctx, &amp;pubKeyPtr, encryptedSignature_2048, 2048u, decryptedSignature);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div><div class="line">    <span class="comment">/* Calculate the hash from the plain text */</span></div><div class="line">    status = <a class="code" href="group__group__cryptolite__lld__sha__functions.html#gaf75a1097e529cb20c9ef8d04f5ccb083">Cy_Cryptolite_Sha256_Run</a>(CRYPTOLITE, plainTxt, <span class="keyword">sizeof</span>(plainTxt)-1, calculatedHash, &amp;sha_ctx);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div><div class="line">    Cy_Cryptolite_InvertEndianness(decryptedSignature, <span class="keyword">sizeof</span>(encryptedSignature_2048));</div><div class="line"></div><div class="line">    <span class="comment">/* Finally verify decrypted signature with calculated digest */</span></div><div class="line">    status = <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga30e087a8a09210e4bf99aefdf5ade151">Cy_Cryptolite_Rsa_Verify</a>(CRYPTOLITE, &amp;rsa_ctx, &amp;verResult, <a class="code" href="group__group__cryptolite__enums.html#gga9dfc40ba7980b0b0d82fcd4ceef4647fa221a4c64dac27b8fa96d4a539d900ce4">CY_CRYPTOLITE_MODE_SHA256</a>, calculatedHash, <span class="keyword">sizeof</span>(calculatedHash), decryptedSignature, <span class="keyword">sizeof</span>(encryptedSignature_2048));</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div><div class="line">    <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#gad9679d4c527d03c5dc1e2f4f8476ca16">Cy_Cryptolite_Rsa_Free</a>(CRYPTOLITE, &amp;rsa_ctx);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check verResult is CY_CRYPTOLITE_SIG_VALID... */</span></div><div class="line"></div></div><!-- fragment --></dd></dl>

</div>
</div>
<a id="ga935311182a513548ec08fe3602a61145"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga935311182a513548ec08fe3602a61145">&#9670;&nbsp;</a></span>Cy_Cryptolite_Rsa_Proc()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> Cy_Cryptolite_Rsa_Proc </td>
          <td>(</td>
          <td class="paramtype">CRYPTOLITE_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__context__rsa__t.html">cy_stc_cryptolite_context_rsa_t</a> *&#160;</td>
          <td class="paramname"><em>cfContext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__rsa__pub__key__t.html">cy_stc_cryptolite_rsa_pub_key_t</a> *&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t const *&#160;</td>
          <td class="paramname"><em>message</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>messageSize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>processedMessage</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>RSA process algorithm based on the Montgomery algorithm using Barrett reduction. </p>
<p><a href="https://en.wikipedia.org/wiki/RSA_%28cryptosystem%29">https://en.wikipedia.org/wiki/RSA_%28cryptosystem%29</a></p>
<p>Key, message, processedMessage buffers must be 4 byte aligned and end with 4 byte boundary.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>The pointer to the CRYPTOLITE instance.</td></tr>
    <tr><td class="paramname">cfContext</td><td>The pointer to the CRYPTOLITE context.</td></tr>
    <tr><td class="paramname">key</td><td>The pointer to the <a class="el" href="structcy__stc__cryptolite__rsa__pub__key__t.html">cy_stc_cryptolite_rsa_pub_key_t</a> structure that stores public key.</td></tr>
    <tr><td class="paramname">message</td><td>The pointer to the message to be processed.</td></tr>
    <tr><td class="paramname">messageSize</td><td>The length of the message to be processed.</td></tr>
    <tr><td class="paramname">processedMessage</td><td>The pointer to processed message.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a></dd></dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line"></div><div class="line"></div><div class="line">    CY_ALIGN(4) uint8_t encryptedSignature_2048[] =</div><div class="line">    {</div><div class="line">        0x86, 0x1c, 0xf4, 0x97, 0xcc, 0xb0, 0xf9, 0x8e, 0xb1, 0x93, 0x20, 0x30, 0x5b, 0xe4, 0xe2, 0xf4,</div><div class="line">        0x30, 0x66, 0xa3, 0x6d, 0xe8, 0x74, 0x4f, 0xa9, 0xe9, 0xd1, 0x16, 0xc5, 0x17, 0xc0, 0x97, 0x1d,</div><div class="line">        0x60, 0x39, 0xb0, 0xda, 0xf4, 0x65, 0xad, 0x7e, 0x59, 0x6c, 0xce, 0x12, 0x29, 0x8b, 0x23, 0xdd,</div><div class="line">        0x4b, 0xb6, 0xd3, 0xb6, 0x7e, 0x2b, 0x5d, 0xae, 0x55, 0x5e, 0x43, 0xf3, 0x61, 0x8a, 0x8c, 0xbd,</div><div class="line">        0x47, 0x59, 0x05, 0x21, 0x4b, 0x54, 0x7b, 0x49, 0xd2, 0xbd, 0x33, 0xdb, 0x82, 0x5d, 0xfc, 0xb4,</div><div class="line">        0xf8, 0xcf, 0x37, 0x2d, 0x2f, 0x04, 0x76, 0x66, 0x0d, 0x16, 0xea, 0x28, 0xb3, 0xde, 0x40, 0x86,</div><div class="line">        0x8d, 0x83, 0x2d, 0xca, 0x6d, 0x5d, 0xac, 0xf5, 0x0e, 0x4f, 0xb3, 0xb3, 0x04, 0xb6, 0x91, 0x87,</div><div class="line">        0xab, 0xac, 0x1f, 0x2f, 0xdc, 0x50, 0xf5, 0x9d, 0x88, 0xe3, 0x20, 0x23, 0xcc, 0xb0, 0x8a, 0x1f,</div><div class="line">        0xf9, 0x7e, 0x08, 0xb0, 0x55, 0x3f, 0xf5, 0xa4, 0x86, 0x25, 0x77, 0x62, 0x7e, 0x51, 0x55, 0xe8,</div><div class="line">        0x1f, 0xd5, 0x24, 0xf5, 0xa8, 0x5a, 0x97, 0xb6, 0x0a, 0x8e, 0xe3, 0x65, 0x6d, 0xfd, 0xe3, 0xc6,</div><div class="line">        0xff, 0x1b, 0x32, 0x0d, 0xdb, 0x99, 0x55, 0x7b, 0x06, 0xd0, 0x98, 0xea, 0xae, 0xa9, 0xbc, 0xcd,</div><div class="line">        0xa1, 0x81, 0xad, 0x07, 0xc7, 0xd8, 0x4a, 0xa9, 0x6e, 0x3f, 0xc6, 0xdf, 0x7c, 0x12, 0xce, 0xb3,</div><div class="line">        0x8e, 0x5d, 0x30, 0x2b, 0xb8, 0x66, 0xf4, 0xf9, 0xc8, 0xa0, 0xcc, 0x83, 0x70, 0x46, 0x31, 0x3a,</div><div class="line">        0x98, 0x29, 0xae, 0x60, 0x38, 0x6f, 0xe2, 0x7e, 0xac, 0x5b, 0x8e, 0x15, 0xa0, 0x21, 0x00, 0x78,</div><div class="line">        0x72, 0x4c, 0x87, 0x70, 0x60, 0x6a, 0x23, 0x9a, 0x49, 0x7f, 0x93, 0xfd, 0x26, 0x3f, 0xb9, 0x3d,</div><div class="line">        0x3e, 0xa8, 0xfe, 0x0a, 0x0c, 0xc6, 0x67, 0x37, 0x19, 0x03, 0xdf, 0xe5, 0x4f, 0x6d, 0x03, 0x4d,</div><div class="line">    };</div><div class="line"></div><div class="line"></div><div class="line">    CY_ALIGN(4) uint8_t modulus_2048[] =</div><div class="line">    {</div><div class="line"></div><div class="line">    <span class="comment">/* Big endian format */</span></div><div class="line">        0xbf,0xbe,0x6e,0xc4,0x9e,0x76,0x9d,0x45,0xf9,0x17,0x32,0x9d,0x4a,0xa0,0xe4,0xf0,</div><div class="line">        0xf9,0x9f,0x02,0x6b,0xb2,0xcb,0x8a,0xe0,0x51,0xd4,0xea,0x7c,0x7c,0xdf,0xa2,0xa9,</div><div class="line">        0xa5,0x5a,0x64,0x42,0x76,0xcd,0x38,0x90,0x3d,0x42,0x91,0x3d,0x1b,0xc6,0x6c,0x80,</div><div class="line">        0xc6,0xd7,0x16,0xcb,0x93,0xfe,0x59,0x1f,0xa7,0x97,0x1f,0x57,0xd5,0x6b,0x33,0x53,</div><div class="line">        0xc8,0x54,0x7f,0xa6,0x4e,0xf8,0x26,0x7e,0x6e,0xd5,0x1f,0x78,0x31,0x32,0xdf,0xca,</div><div class="line">        0x82,0x39,0xb1,0x42,0x57,0xa8,0xa8,0x9f,0x93,0x4e,0x39,0x7b,0xa7,0xf0,0x39,0x61,</div><div class="line">        0x42,0x31,0x38,0xa2,0xff,0x05,0xf5,0x0d,0x06,0x0d,0x26,0x66,0xe5,0x71,0x6f,0x0d,</div><div class="line">        0x52,0x24,0x6f,0x4d,0x83,0x8e,0x97,0xda,0x88,0x91,0x41,0xe4,0x16,0x31,0x70,0x69,</div><div class="line">        0xea,0x3a,0x61,0x4f,0xb3,0x58,0x4c,0xc7,0xdd,0xf0,0x6a,0xd0,0x7b,0xa5,0x2c,0x47,</div><div class="line">        0x03,0x06,0x7a,0x31,0x8f,0xab,0xc7,0xca,0x73,0xc4,0xa9,0xe8,0x17,0xd3,0xff,0x2e,</div><div class="line">        0x2b,0x0d,0x60,0x48,0x5d,0x69,0x8a,0xa0,0xb4,0x8e,0x37,0xe9,0xf5,0x2d,0xb7,0x5f,</div><div class="line">        0xfd,0x27,0x2b,0x65,0x05,0xfc,0xab,0x43,0x43,0xdc,0x84,0x40,0x7f,0x1b,0x67,0x7d,</div><div class="line">        0x7e,0xc1,0xa7,0xf5,0x37,0xfa,0xb9,0xcd,0x56,0x7f,0xde,0xb3,0xb8,0x76,0x90,0xf4,</div><div class="line">        0x00,0x3b,0xcc,0x9b,0xb6,0xf8,0xec,0xbc,0x41,0x92,0x71,0xe3,0xe2,0xf3,0x0d,0xf9,</div><div class="line">        0xd7,0x7a,0x2a,0x27,0x3f,0x80,0xb3,0x98,0x9d,0x39,0xaa,0x10,0xdc,0x8b,0x6c,0x16,</div><div class="line">        0xca,0x97,0xef,0x55,0xd6,0x5f,0x18,0x89,0x61,0x0e,0x24,0xb9,0x11,0x4d,0x6e,0xc7</div><div class="line">    };</div><div class="line"></div><div class="line">    CY_ALIGN(4)  uint8_t plainTxt[] = &quot;abc&quot;;</div><div class="line"></div><div class="line">    CY_ALIGN(4) uint8_t publicExponent[] =</div><div class="line">    {</div><div class="line">    <span class="comment">/* This is a part of public key. (So called e)</span></div><div class="line"><span class="comment">    * Refer public_key.txt</span></div><div class="line"><span class="comment">    */</span></div><div class="line">    <span class="comment">/* Big endian format */</span></div><div class="line">        0x01, 0x00, 0x01</div><div class="line">    };</div><div class="line"></div><div class="line">    CY_ALIGN(4) uint8_t barretCoef[4*VU_BITS_TO_WORDS(CY_CRYPTOLITE_RSA_BITSIZE+1)]={0};  <span class="comment">/* Must be modulo length + 1 BITS */</span></div><div class="line">    CY_ALIGN(4) uint8_t inverseModulo[4*VU_BITS_TO_WORDS(CY_CRYPTOLITE_RSA_BITSIZE+1)]={0};    <span class="comment">/* Must be same as modulo length */</span></div><div class="line">    CY_ALIGN(4) uint8_t rBar[4*VU_BITS_TO_WORDS(CY_CRYPTOLITE_RSA_BITSIZE+1)]={0};             <span class="comment">/* Must be same as modulo length */</span></div><div class="line"></div><div class="line"></div><div class="line">    CY_ALIGN(4)uint8_t decryptedSignature[2048/8]={0};</div><div class="line">    CY_ALIGN(4) uint8_t calculatedHash[32]={0};</div><div class="line">    <a class="code" href="structcy__stc__cryptolite__rsa__buffer__t.html">cy_stc_cryptolite_rsa_buffer_t</a> rsa_buffer;</div><div class="line"></div><div class="line">    <a class="code" href="structcy__stc__cryptolite__context__rsa__t.html">cy_stc_cryptolite_context_rsa_t</a> rsa_ctx;</div><div class="line">    <a class="code" href="structcy__stc__cryptolite__context__sha256__t.html">cy_stc_cryptolite_context_sha256_t</a> sha_ctx;</div><div class="line">    <a class="code" href="group__group__cryptolite__enums.html#gafc6e4a5cca26d2fe19ba6d8c3429a4df">cy_en_cryptolite_sig_verify_result_t</a> verResult;</div><div class="line">    <a class="code" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> status;</div><div class="line"></div><div class="line">    verResult = <a class="code" href="group__group__cryptolite__enums.html#ggafc6e4a5cca26d2fe19ba6d8c3429a4dfa353581c237f64d4bdceb04a44b156cd0">CY_CRYPTOLITE_SIG_INVALID</a>;</div><div class="line">    memset((<span class="keywordtype">void</span>*)&amp;decryptedSignature, 0u, <span class="keyword">sizeof</span>(decryptedSignature));</div><div class="line">    memset((<span class="keywordtype">void</span>*)&amp;calculatedHash, 0u, <span class="keyword">sizeof</span>(calculatedHash));</div><div class="line">    memset((<span class="keywordtype">void</span>*)&amp;rsa_buffer, 0u, <span class="keyword">sizeof</span>(rsa_buffer));</div><div class="line">    memset((<span class="keywordtype">void</span>*)&amp;rsa_ctx, 0u, <span class="keyword">sizeof</span>(rsa_ctx));</div><div class="line">    memset((<span class="keywordtype">void</span>*)&amp;sha_ctx, 0u, <span class="keyword">sizeof</span>(sha_ctx));</div><div class="line"></div><div class="line">    Cy_Cryptolite_InvertEndianness(modulus_2048, 2048u/8 );</div><div class="line">    Cy_Cryptolite_InvertEndianness(encryptedSignature_2048, <span class="keyword">sizeof</span>(encryptedSignature_2048) );</div><div class="line"></div><div class="line">    Cy_Cryptolite_InvertEndianness(publicExponent, <span class="keyword">sizeof</span>(publicExponent));</div><div class="line"></div><div class="line">    <a class="code" href="structcy__stc__cryptolite__rsa__pub__key__t.html">cy_stc_cryptolite_rsa_pub_key_t</a> pubKeyPtr =</div><div class="line">    {</div><div class="line">        .<a class="code" href="structcy__stc__cryptolite__rsa__pub__key__t.html#af693adcbc706181816a873bf82107f87">moduloPtr</a>          = modulus_2048,</div><div class="line">        .moduloLength       = 2048u,</div><div class="line">        .pubExpPtr          = publicExponent,</div><div class="line">        .pubExpLength       = <span class="keyword">sizeof</span>(publicExponent)* 8,       <span class="comment">/* 17 bits */</span></div><div class="line">        .barretCoefPtr       = barretCoef,</div><div class="line">        .inverseModuloPtr    = inverseModulo,</div><div class="line">        .rBarPtr             = rBar,</div><div class="line">        .preCalculatedCoeff  = <span class="keyword">false</span></div><div class="line">    };</div><div class="line"></div><div class="line">    status = <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga9e98470af0fe0cd1150107725e79faff">Cy_Cryptolite_Rsa_Init</a>(CRYPTOLITE, &amp;rsa_ctx, &amp;rsa_buffer);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div><div class="line">    <span class="comment">/* At first decrypt the received signature. */</span></div><div class="line">    status = <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga935311182a513548ec08fe3602a61145">Cy_Cryptolite_Rsa_Proc</a>(CRYPTOLITE, &amp;rsa_ctx, &amp;pubKeyPtr, encryptedSignature_2048, 2048u, decryptedSignature);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div><div class="line">    <span class="comment">/* Calculate the hash from the plain text */</span></div><div class="line">    status = <a class="code" href="group__group__cryptolite__lld__sha__functions.html#gaf75a1097e529cb20c9ef8d04f5ccb083">Cy_Cryptolite_Sha256_Run</a>(CRYPTOLITE, plainTxt, <span class="keyword">sizeof</span>(plainTxt)-1, calculatedHash, &amp;sha_ctx);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div><div class="line">    Cy_Cryptolite_InvertEndianness(decryptedSignature, <span class="keyword">sizeof</span>(encryptedSignature_2048));</div><div class="line"></div><div class="line">    <span class="comment">/* Finally verify decrypted signature with calculated digest */</span></div><div class="line">    status = <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga30e087a8a09210e4bf99aefdf5ade151">Cy_Cryptolite_Rsa_Verify</a>(CRYPTOLITE, &amp;rsa_ctx, &amp;verResult, <a class="code" href="group__group__cryptolite__enums.html#gga9dfc40ba7980b0b0d82fcd4ceef4647fa221a4c64dac27b8fa96d4a539d900ce4">CY_CRYPTOLITE_MODE_SHA256</a>, calculatedHash, <span class="keyword">sizeof</span>(calculatedHash), decryptedSignature, <span class="keyword">sizeof</span>(encryptedSignature_2048));</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div><div class="line">    <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#gad9679d4c527d03c5dc1e2f4f8476ca16">Cy_Cryptolite_Rsa_Free</a>(CRYPTOLITE, &amp;rsa_ctx);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check verResult is CY_CRYPTOLITE_SIG_VALID... */</span></div><div class="line"></div></div><!-- fragment --></dd></dl>

</div>
</div>
<a id="gabb3cb1f3c4cc065655d752e833a10211"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gabb3cb1f3c4cc065655d752e833a10211">&#9670;&nbsp;</a></span>Cy_Cryptolite_Rsa_Coef()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> Cy_Cryptolite_Rsa_Coef </td>
          <td>(</td>
          <td class="paramtype">CRYPTOLITE_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__context__rsa__t.html">cy_stc_cryptolite_context_rsa_t</a> *&#160;</td>
          <td class="paramname"><em>cfContext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__rsa__pub__key__t.html">cy_stc_cryptolite_rsa_pub_key_t</a> *&#160;</td>
          <td class="paramname"><em>key</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculation constant coefficients to speed-up Montgomery algorithm. </p>
<p>These coefficients are: coefficient for Barrett reduction, binary inverse of the modulo, result of (2^moduloLength mod modulo)</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>The pointer to the CRYPTOLITE instance.</td></tr>
    <tr><td class="paramname">cfContext</td><td>The pointer to the CRYPTOLITE context.</td></tr>
    <tr><td class="paramname">key</td><td>The pointer to the <a class="el" href="structcy__stc__cryptolite__rsa__pub__key__t.html">cy_stc_cryptolite_rsa_pub_key_t</a> structure that stores a public key.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> </dd></dl>

</div>
</div>
<a id="gad9679d4c527d03c5dc1e2f4f8476ca16"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad9679d4c527d03c5dc1e2f4f8476ca16">&#9670;&nbsp;</a></span>Cy_Cryptolite_Rsa_Free()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> Cy_Cryptolite_Rsa_Free </td>
          <td>(</td>
          <td class="paramtype">CRYPTOLITE_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__context__rsa__t.html">cy_stc_cryptolite_context_rsa_t</a> *&#160;</td>
          <td class="paramname"><em>cfContext</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Cleanup the RSA context. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>The pointer to the CRYPTOLITE instance.</td></tr>
    <tr><td class="paramname">cfContext</td><td>The pointer to the CRYPTOLITE context.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a></dd></dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line"></div><div class="line"></div><div class="line">    CY_ALIGN(4) uint8_t encryptedSignature_2048[] =</div><div class="line">    {</div><div class="line">        0x86, 0x1c, 0xf4, 0x97, 0xcc, 0xb0, 0xf9, 0x8e, 0xb1, 0x93, 0x20, 0x30, 0x5b, 0xe4, 0xe2, 0xf4,</div><div class="line">        0x30, 0x66, 0xa3, 0x6d, 0xe8, 0x74, 0x4f, 0xa9, 0xe9, 0xd1, 0x16, 0xc5, 0x17, 0xc0, 0x97, 0x1d,</div><div class="line">        0x60, 0x39, 0xb0, 0xda, 0xf4, 0x65, 0xad, 0x7e, 0x59, 0x6c, 0xce, 0x12, 0x29, 0x8b, 0x23, 0xdd,</div><div class="line">        0x4b, 0xb6, 0xd3, 0xb6, 0x7e, 0x2b, 0x5d, 0xae, 0x55, 0x5e, 0x43, 0xf3, 0x61, 0x8a, 0x8c, 0xbd,</div><div class="line">        0x47, 0x59, 0x05, 0x21, 0x4b, 0x54, 0x7b, 0x49, 0xd2, 0xbd, 0x33, 0xdb, 0x82, 0x5d, 0xfc, 0xb4,</div><div class="line">        0xf8, 0xcf, 0x37, 0x2d, 0x2f, 0x04, 0x76, 0x66, 0x0d, 0x16, 0xea, 0x28, 0xb3, 0xde, 0x40, 0x86,</div><div class="line">        0x8d, 0x83, 0x2d, 0xca, 0x6d, 0x5d, 0xac, 0xf5, 0x0e, 0x4f, 0xb3, 0xb3, 0x04, 0xb6, 0x91, 0x87,</div><div class="line">        0xab, 0xac, 0x1f, 0x2f, 0xdc, 0x50, 0xf5, 0x9d, 0x88, 0xe3, 0x20, 0x23, 0xcc, 0xb0, 0x8a, 0x1f,</div><div class="line">        0xf9, 0x7e, 0x08, 0xb0, 0x55, 0x3f, 0xf5, 0xa4, 0x86, 0x25, 0x77, 0x62, 0x7e, 0x51, 0x55, 0xe8,</div><div class="line">        0x1f, 0xd5, 0x24, 0xf5, 0xa8, 0x5a, 0x97, 0xb6, 0x0a, 0x8e, 0xe3, 0x65, 0x6d, 0xfd, 0xe3, 0xc6,</div><div class="line">        0xff, 0x1b, 0x32, 0x0d, 0xdb, 0x99, 0x55, 0x7b, 0x06, 0xd0, 0x98, 0xea, 0xae, 0xa9, 0xbc, 0xcd,</div><div class="line">        0xa1, 0x81, 0xad, 0x07, 0xc7, 0xd8, 0x4a, 0xa9, 0x6e, 0x3f, 0xc6, 0xdf, 0x7c, 0x12, 0xce, 0xb3,</div><div class="line">        0x8e, 0x5d, 0x30, 0x2b, 0xb8, 0x66, 0xf4, 0xf9, 0xc8, 0xa0, 0xcc, 0x83, 0x70, 0x46, 0x31, 0x3a,</div><div class="line">        0x98, 0x29, 0xae, 0x60, 0x38, 0x6f, 0xe2, 0x7e, 0xac, 0x5b, 0x8e, 0x15, 0xa0, 0x21, 0x00, 0x78,</div><div class="line">        0x72, 0x4c, 0x87, 0x70, 0x60, 0x6a, 0x23, 0x9a, 0x49, 0x7f, 0x93, 0xfd, 0x26, 0x3f, 0xb9, 0x3d,</div><div class="line">        0x3e, 0xa8, 0xfe, 0x0a, 0x0c, 0xc6, 0x67, 0x37, 0x19, 0x03, 0xdf, 0xe5, 0x4f, 0x6d, 0x03, 0x4d,</div><div class="line">    };</div><div class="line"></div><div class="line"></div><div class="line">    CY_ALIGN(4) uint8_t modulus_2048[] =</div><div class="line">    {</div><div class="line"></div><div class="line">    <span class="comment">/* Big endian format */</span></div><div class="line">        0xbf,0xbe,0x6e,0xc4,0x9e,0x76,0x9d,0x45,0xf9,0x17,0x32,0x9d,0x4a,0xa0,0xe4,0xf0,</div><div class="line">        0xf9,0x9f,0x02,0x6b,0xb2,0xcb,0x8a,0xe0,0x51,0xd4,0xea,0x7c,0x7c,0xdf,0xa2,0xa9,</div><div class="line">        0xa5,0x5a,0x64,0x42,0x76,0xcd,0x38,0x90,0x3d,0x42,0x91,0x3d,0x1b,0xc6,0x6c,0x80,</div><div class="line">        0xc6,0xd7,0x16,0xcb,0x93,0xfe,0x59,0x1f,0xa7,0x97,0x1f,0x57,0xd5,0x6b,0x33,0x53,</div><div class="line">        0xc8,0x54,0x7f,0xa6,0x4e,0xf8,0x26,0x7e,0x6e,0xd5,0x1f,0x78,0x31,0x32,0xdf,0xca,</div><div class="line">        0x82,0x39,0xb1,0x42,0x57,0xa8,0xa8,0x9f,0x93,0x4e,0x39,0x7b,0xa7,0xf0,0x39,0x61,</div><div class="line">        0x42,0x31,0x38,0xa2,0xff,0x05,0xf5,0x0d,0x06,0x0d,0x26,0x66,0xe5,0x71,0x6f,0x0d,</div><div class="line">        0x52,0x24,0x6f,0x4d,0x83,0x8e,0x97,0xda,0x88,0x91,0x41,0xe4,0x16,0x31,0x70,0x69,</div><div class="line">        0xea,0x3a,0x61,0x4f,0xb3,0x58,0x4c,0xc7,0xdd,0xf0,0x6a,0xd0,0x7b,0xa5,0x2c,0x47,</div><div class="line">        0x03,0x06,0x7a,0x31,0x8f,0xab,0xc7,0xca,0x73,0xc4,0xa9,0xe8,0x17,0xd3,0xff,0x2e,</div><div class="line">        0x2b,0x0d,0x60,0x48,0x5d,0x69,0x8a,0xa0,0xb4,0x8e,0x37,0xe9,0xf5,0x2d,0xb7,0x5f,</div><div class="line">        0xfd,0x27,0x2b,0x65,0x05,0xfc,0xab,0x43,0x43,0xdc,0x84,0x40,0x7f,0x1b,0x67,0x7d,</div><div class="line">        0x7e,0xc1,0xa7,0xf5,0x37,0xfa,0xb9,0xcd,0x56,0x7f,0xde,0xb3,0xb8,0x76,0x90,0xf4,</div><div class="line">        0x00,0x3b,0xcc,0x9b,0xb6,0xf8,0xec,0xbc,0x41,0x92,0x71,0xe3,0xe2,0xf3,0x0d,0xf9,</div><div class="line">        0xd7,0x7a,0x2a,0x27,0x3f,0x80,0xb3,0x98,0x9d,0x39,0xaa,0x10,0xdc,0x8b,0x6c,0x16,</div><div class="line">        0xca,0x97,0xef,0x55,0xd6,0x5f,0x18,0x89,0x61,0x0e,0x24,0xb9,0x11,0x4d,0x6e,0xc7</div><div class="line">    };</div><div class="line"></div><div class="line">    CY_ALIGN(4)  uint8_t plainTxt[] = &quot;abc&quot;;</div><div class="line"></div><div class="line">    CY_ALIGN(4) uint8_t publicExponent[] =</div><div class="line">    {</div><div class="line">    <span class="comment">/* This is a part of public key. (So called e)</span></div><div class="line"><span class="comment">    * Refer public_key.txt</span></div><div class="line"><span class="comment">    */</span></div><div class="line">    <span class="comment">/* Big endian format */</span></div><div class="line">        0x01, 0x00, 0x01</div><div class="line">    };</div><div class="line"></div><div class="line">    CY_ALIGN(4) uint8_t barretCoef[4*VU_BITS_TO_WORDS(CY_CRYPTOLITE_RSA_BITSIZE+1)]={0};  <span class="comment">/* Must be modulo length + 1 BITS */</span></div><div class="line">    CY_ALIGN(4) uint8_t inverseModulo[4*VU_BITS_TO_WORDS(CY_CRYPTOLITE_RSA_BITSIZE+1)]={0};    <span class="comment">/* Must be same as modulo length */</span></div><div class="line">    CY_ALIGN(4) uint8_t rBar[4*VU_BITS_TO_WORDS(CY_CRYPTOLITE_RSA_BITSIZE+1)]={0};             <span class="comment">/* Must be same as modulo length */</span></div><div class="line"></div><div class="line"></div><div class="line">    CY_ALIGN(4)uint8_t decryptedSignature[2048/8]={0};</div><div class="line">    CY_ALIGN(4) uint8_t calculatedHash[32]={0};</div><div class="line">    <a class="code" href="structcy__stc__cryptolite__rsa__buffer__t.html">cy_stc_cryptolite_rsa_buffer_t</a> rsa_buffer;</div><div class="line"></div><div class="line">    <a class="code" href="structcy__stc__cryptolite__context__rsa__t.html">cy_stc_cryptolite_context_rsa_t</a> rsa_ctx;</div><div class="line">    <a class="code" href="structcy__stc__cryptolite__context__sha256__t.html">cy_stc_cryptolite_context_sha256_t</a> sha_ctx;</div><div class="line">    <a class="code" href="group__group__cryptolite__enums.html#gafc6e4a5cca26d2fe19ba6d8c3429a4df">cy_en_cryptolite_sig_verify_result_t</a> verResult;</div><div class="line">    <a class="code" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> status;</div><div class="line"></div><div class="line">    verResult = <a class="code" href="group__group__cryptolite__enums.html#ggafc6e4a5cca26d2fe19ba6d8c3429a4dfa353581c237f64d4bdceb04a44b156cd0">CY_CRYPTOLITE_SIG_INVALID</a>;</div><div class="line">    memset((<span class="keywordtype">void</span>*)&amp;decryptedSignature, 0u, <span class="keyword">sizeof</span>(decryptedSignature));</div><div class="line">    memset((<span class="keywordtype">void</span>*)&amp;calculatedHash, 0u, <span class="keyword">sizeof</span>(calculatedHash));</div><div class="line">    memset((<span class="keywordtype">void</span>*)&amp;rsa_buffer, 0u, <span class="keyword">sizeof</span>(rsa_buffer));</div><div class="line">    memset((<span class="keywordtype">void</span>*)&amp;rsa_ctx, 0u, <span class="keyword">sizeof</span>(rsa_ctx));</div><div class="line">    memset((<span class="keywordtype">void</span>*)&amp;sha_ctx, 0u, <span class="keyword">sizeof</span>(sha_ctx));</div><div class="line"></div><div class="line">    Cy_Cryptolite_InvertEndianness(modulus_2048, 2048u/8 );</div><div class="line">    Cy_Cryptolite_InvertEndianness(encryptedSignature_2048, <span class="keyword">sizeof</span>(encryptedSignature_2048) );</div><div class="line"></div><div class="line">    Cy_Cryptolite_InvertEndianness(publicExponent, <span class="keyword">sizeof</span>(publicExponent));</div><div class="line"></div><div class="line">    <a class="code" href="structcy__stc__cryptolite__rsa__pub__key__t.html">cy_stc_cryptolite_rsa_pub_key_t</a> pubKeyPtr =</div><div class="line">    {</div><div class="line">        .<a class="code" href="structcy__stc__cryptolite__rsa__pub__key__t.html#af693adcbc706181816a873bf82107f87">moduloPtr</a>          = modulus_2048,</div><div class="line">        .moduloLength       = 2048u,</div><div class="line">        .pubExpPtr          = publicExponent,</div><div class="line">        .pubExpLength       = <span class="keyword">sizeof</span>(publicExponent)* 8,       <span class="comment">/* 17 bits */</span></div><div class="line">        .barretCoefPtr       = barretCoef,</div><div class="line">        .inverseModuloPtr    = inverseModulo,</div><div class="line">        .rBarPtr             = rBar,</div><div class="line">        .preCalculatedCoeff  = <span class="keyword">false</span></div><div class="line">    };</div><div class="line"></div><div class="line">    status = <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga9e98470af0fe0cd1150107725e79faff">Cy_Cryptolite_Rsa_Init</a>(CRYPTOLITE, &amp;rsa_ctx, &amp;rsa_buffer);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div><div class="line">    <span class="comment">/* At first decrypt the received signature. */</span></div><div class="line">    status = <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga935311182a513548ec08fe3602a61145">Cy_Cryptolite_Rsa_Proc</a>(CRYPTOLITE, &amp;rsa_ctx, &amp;pubKeyPtr, encryptedSignature_2048, 2048u, decryptedSignature);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div><div class="line">    <span class="comment">/* Calculate the hash from the plain text */</span></div><div class="line">    status = <a class="code" href="group__group__cryptolite__lld__sha__functions.html#gaf75a1097e529cb20c9ef8d04f5ccb083">Cy_Cryptolite_Sha256_Run</a>(CRYPTOLITE, plainTxt, <span class="keyword">sizeof</span>(plainTxt)-1, calculatedHash, &amp;sha_ctx);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div><div class="line">    Cy_Cryptolite_InvertEndianness(decryptedSignature, <span class="keyword">sizeof</span>(encryptedSignature_2048));</div><div class="line"></div><div class="line">    <span class="comment">/* Finally verify decrypted signature with calculated digest */</span></div><div class="line">    status = <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga30e087a8a09210e4bf99aefdf5ade151">Cy_Cryptolite_Rsa_Verify</a>(CRYPTOLITE, &amp;rsa_ctx, &amp;verResult, <a class="code" href="group__group__cryptolite__enums.html#gga9dfc40ba7980b0b0d82fcd4ceef4647fa221a4c64dac27b8fa96d4a539d900ce4">CY_CRYPTOLITE_MODE_SHA256</a>, calculatedHash, <span class="keyword">sizeof</span>(calculatedHash), decryptedSignature, <span class="keyword">sizeof</span>(encryptedSignature_2048));</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div><div class="line">    <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#gad9679d4c527d03c5dc1e2f4f8476ca16">Cy_Cryptolite_Rsa_Free</a>(CRYPTOLITE, &amp;rsa_ctx);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check verResult is CY_CRYPTOLITE_SIG_VALID... */</span></div><div class="line"></div></div><!-- fragment --></dd></dl>

</div>
</div>
<a id="ga30e087a8a09210e4bf99aefdf5ade151"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga30e087a8a09210e4bf99aefdf5ade151">&#9670;&nbsp;</a></span>Cy_Cryptolite_Rsa_Verify()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> Cy_Cryptolite_Rsa_Verify </td>
          <td>(</td>
          <td class="paramtype">CRYPTOLITE_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__cryptolite__context__rsa__t.html">cy_stc_cryptolite_context_rsa_t</a> *&#160;</td>
          <td class="paramname"><em>cfContext</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__cryptolite__enums.html#gafc6e4a5cca26d2fe19ba6d8c3429a4df">cy_en_cryptolite_sig_verify_result_t</a> *&#160;</td>
          <td class="paramname"><em>verResult</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__cryptolite__enums.html#ga9dfc40ba7980b0b0d82fcd4ceef4647f">cy_en_cryptolite_sha_mode_t</a>&#160;</td>
          <td class="paramname"><em>digestType</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t const *&#160;</td>
          <td class="paramname"><em>digest</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>digestLength</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t const *&#160;</td>
          <td class="paramname"><em>decryptedSignature</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>decryptedSignatureLength</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>RSA verification with checks for content, paddings and signature format. </p>
<p>SHA digest of the message and decrypted message should be calculated before. Supports only PKCS1-v1_5 format, inside of this format supported padding using only SHA, cases with MD2 and MD5 are not supported. PKCS1-v1_5 described here, page 31: <a href="http://www.emc.com/collateral/white-papers/h11300-pkcs-1v2-2-rsa-cryptography-standard-wp.pdf">http://www.emc.com/collateral/white-papers/h11300-pkcs-1v2-2-rsa-cryptography-standard-wp.pdf</a></p>
<p>The digest and decryptedSignature buffers must be 4 byte aligned</p>
<p>Returns the verification result <a class="el" href="group__group__cryptolite__enums.html#gafc6e4a5cca26d2fe19ba6d8c3429a4df">cy_en_cryptolite_sig_verify_result_t</a>.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>The pointer to the CRYPTOLITE instance.</td></tr>
    <tr><td class="paramname">cfContext</td><td>The pointer to the CRYPTOLITE context.</td></tr>
    <tr><td class="paramname">verResult</td><td>The pointer to the verification result <a class="el" href="group__group__cryptolite__enums.html#gafc6e4a5cca26d2fe19ba6d8c3429a4df">cy_en_cryptolite_sig_verify_result_t</a>.</td></tr>
    <tr><td class="paramname">digestType</td><td>SHA mode used for hash calculation <a class="el" href="group__group__cryptolite__enums.html#ga9dfc40ba7980b0b0d82fcd4ceef4647f">cy_en_cryptolite_sha_mode_t</a>.</td></tr>
    <tr><td class="paramname">digest</td><td>The pointer to the hash of the message or the message whose signature is to be verified.</td></tr>
    <tr><td class="paramname">digestLength</td><td>The length of the message whose signature is to be verified and is applicable for CY_CRYPTOLITE_MODE_SHA_NONE mode.</td></tr>
    <tr><td class="paramname">decryptedSignature</td><td>The pointer to the decrypted signature to be verified.</td></tr>
    <tr><td class="paramname">decryptedSignatureLength</td><td>The length of the decrypted signature to be verified (in bytes)</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a></dd></dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line"></div><div class="line"></div><div class="line">    CY_ALIGN(4) uint8_t encryptedSignature_2048[] =</div><div class="line">    {</div><div class="line">        0x86, 0x1c, 0xf4, 0x97, 0xcc, 0xb0, 0xf9, 0x8e, 0xb1, 0x93, 0x20, 0x30, 0x5b, 0xe4, 0xe2, 0xf4,</div><div class="line">        0x30, 0x66, 0xa3, 0x6d, 0xe8, 0x74, 0x4f, 0xa9, 0xe9, 0xd1, 0x16, 0xc5, 0x17, 0xc0, 0x97, 0x1d,</div><div class="line">        0x60, 0x39, 0xb0, 0xda, 0xf4, 0x65, 0xad, 0x7e, 0x59, 0x6c, 0xce, 0x12, 0x29, 0x8b, 0x23, 0xdd,</div><div class="line">        0x4b, 0xb6, 0xd3, 0xb6, 0x7e, 0x2b, 0x5d, 0xae, 0x55, 0x5e, 0x43, 0xf3, 0x61, 0x8a, 0x8c, 0xbd,</div><div class="line">        0x47, 0x59, 0x05, 0x21, 0x4b, 0x54, 0x7b, 0x49, 0xd2, 0xbd, 0x33, 0xdb, 0x82, 0x5d, 0xfc, 0xb4,</div><div class="line">        0xf8, 0xcf, 0x37, 0x2d, 0x2f, 0x04, 0x76, 0x66, 0x0d, 0x16, 0xea, 0x28, 0xb3, 0xde, 0x40, 0x86,</div><div class="line">        0x8d, 0x83, 0x2d, 0xca, 0x6d, 0x5d, 0xac, 0xf5, 0x0e, 0x4f, 0xb3, 0xb3, 0x04, 0xb6, 0x91, 0x87,</div><div class="line">        0xab, 0xac, 0x1f, 0x2f, 0xdc, 0x50, 0xf5, 0x9d, 0x88, 0xe3, 0x20, 0x23, 0xcc, 0xb0, 0x8a, 0x1f,</div><div class="line">        0xf9, 0x7e, 0x08, 0xb0, 0x55, 0x3f, 0xf5, 0xa4, 0x86, 0x25, 0x77, 0x62, 0x7e, 0x51, 0x55, 0xe8,</div><div class="line">        0x1f, 0xd5, 0x24, 0xf5, 0xa8, 0x5a, 0x97, 0xb6, 0x0a, 0x8e, 0xe3, 0x65, 0x6d, 0xfd, 0xe3, 0xc6,</div><div class="line">        0xff, 0x1b, 0x32, 0x0d, 0xdb, 0x99, 0x55, 0x7b, 0x06, 0xd0, 0x98, 0xea, 0xae, 0xa9, 0xbc, 0xcd,</div><div class="line">        0xa1, 0x81, 0xad, 0x07, 0xc7, 0xd8, 0x4a, 0xa9, 0x6e, 0x3f, 0xc6, 0xdf, 0x7c, 0x12, 0xce, 0xb3,</div><div class="line">        0x8e, 0x5d, 0x30, 0x2b, 0xb8, 0x66, 0xf4, 0xf9, 0xc8, 0xa0, 0xcc, 0x83, 0x70, 0x46, 0x31, 0x3a,</div><div class="line">        0x98, 0x29, 0xae, 0x60, 0x38, 0x6f, 0xe2, 0x7e, 0xac, 0x5b, 0x8e, 0x15, 0xa0, 0x21, 0x00, 0x78,</div><div class="line">        0x72, 0x4c, 0x87, 0x70, 0x60, 0x6a, 0x23, 0x9a, 0x49, 0x7f, 0x93, 0xfd, 0x26, 0x3f, 0xb9, 0x3d,</div><div class="line">        0x3e, 0xa8, 0xfe, 0x0a, 0x0c, 0xc6, 0x67, 0x37, 0x19, 0x03, 0xdf, 0xe5, 0x4f, 0x6d, 0x03, 0x4d,</div><div class="line">    };</div><div class="line"></div><div class="line"></div><div class="line">    CY_ALIGN(4) uint8_t modulus_2048[] =</div><div class="line">    {</div><div class="line"></div><div class="line">    <span class="comment">/* Big endian format */</span></div><div class="line">        0xbf,0xbe,0x6e,0xc4,0x9e,0x76,0x9d,0x45,0xf9,0x17,0x32,0x9d,0x4a,0xa0,0xe4,0xf0,</div><div class="line">        0xf9,0x9f,0x02,0x6b,0xb2,0xcb,0x8a,0xe0,0x51,0xd4,0xea,0x7c,0x7c,0xdf,0xa2,0xa9,</div><div class="line">        0xa5,0x5a,0x64,0x42,0x76,0xcd,0x38,0x90,0x3d,0x42,0x91,0x3d,0x1b,0xc6,0x6c,0x80,</div><div class="line">        0xc6,0xd7,0x16,0xcb,0x93,0xfe,0x59,0x1f,0xa7,0x97,0x1f,0x57,0xd5,0x6b,0x33,0x53,</div><div class="line">        0xc8,0x54,0x7f,0xa6,0x4e,0xf8,0x26,0x7e,0x6e,0xd5,0x1f,0x78,0x31,0x32,0xdf,0xca,</div><div class="line">        0x82,0x39,0xb1,0x42,0x57,0xa8,0xa8,0x9f,0x93,0x4e,0x39,0x7b,0xa7,0xf0,0x39,0x61,</div><div class="line">        0x42,0x31,0x38,0xa2,0xff,0x05,0xf5,0x0d,0x06,0x0d,0x26,0x66,0xe5,0x71,0x6f,0x0d,</div><div class="line">        0x52,0x24,0x6f,0x4d,0x83,0x8e,0x97,0xda,0x88,0x91,0x41,0xe4,0x16,0x31,0x70,0x69,</div><div class="line">        0xea,0x3a,0x61,0x4f,0xb3,0x58,0x4c,0xc7,0xdd,0xf0,0x6a,0xd0,0x7b,0xa5,0x2c,0x47,</div><div class="line">        0x03,0x06,0x7a,0x31,0x8f,0xab,0xc7,0xca,0x73,0xc4,0xa9,0xe8,0x17,0xd3,0xff,0x2e,</div><div class="line">        0x2b,0x0d,0x60,0x48,0x5d,0x69,0x8a,0xa0,0xb4,0x8e,0x37,0xe9,0xf5,0x2d,0xb7,0x5f,</div><div class="line">        0xfd,0x27,0x2b,0x65,0x05,0xfc,0xab,0x43,0x43,0xdc,0x84,0x40,0x7f,0x1b,0x67,0x7d,</div><div class="line">        0x7e,0xc1,0xa7,0xf5,0x37,0xfa,0xb9,0xcd,0x56,0x7f,0xde,0xb3,0xb8,0x76,0x90,0xf4,</div><div class="line">        0x00,0x3b,0xcc,0x9b,0xb6,0xf8,0xec,0xbc,0x41,0x92,0x71,0xe3,0xe2,0xf3,0x0d,0xf9,</div><div class="line">        0xd7,0x7a,0x2a,0x27,0x3f,0x80,0xb3,0x98,0x9d,0x39,0xaa,0x10,0xdc,0x8b,0x6c,0x16,</div><div class="line">        0xca,0x97,0xef,0x55,0xd6,0x5f,0x18,0x89,0x61,0x0e,0x24,0xb9,0x11,0x4d,0x6e,0xc7</div><div class="line">    };</div><div class="line"></div><div class="line">    CY_ALIGN(4)  uint8_t plainTxt[] = &quot;abc&quot;;</div><div class="line"></div><div class="line">    CY_ALIGN(4) uint8_t publicExponent[] =</div><div class="line">    {</div><div class="line">    <span class="comment">/* This is a part of public key. (So called e)</span></div><div class="line"><span class="comment">    * Refer public_key.txt</span></div><div class="line"><span class="comment">    */</span></div><div class="line">    <span class="comment">/* Big endian format */</span></div><div class="line">        0x01, 0x00, 0x01</div><div class="line">    };</div><div class="line"></div><div class="line">    CY_ALIGN(4) uint8_t barretCoef[4*VU_BITS_TO_WORDS(CY_CRYPTOLITE_RSA_BITSIZE+1)]={0};  <span class="comment">/* Must be modulo length + 1 BITS */</span></div><div class="line">    CY_ALIGN(4) uint8_t inverseModulo[4*VU_BITS_TO_WORDS(CY_CRYPTOLITE_RSA_BITSIZE+1)]={0};    <span class="comment">/* Must be same as modulo length */</span></div><div class="line">    CY_ALIGN(4) uint8_t rBar[4*VU_BITS_TO_WORDS(CY_CRYPTOLITE_RSA_BITSIZE+1)]={0};             <span class="comment">/* Must be same as modulo length */</span></div><div class="line"></div><div class="line"></div><div class="line">    CY_ALIGN(4)uint8_t decryptedSignature[2048/8]={0};</div><div class="line">    CY_ALIGN(4) uint8_t calculatedHash[32]={0};</div><div class="line">    <a class="code" href="structcy__stc__cryptolite__rsa__buffer__t.html">cy_stc_cryptolite_rsa_buffer_t</a> rsa_buffer;</div><div class="line"></div><div class="line">    <a class="code" href="structcy__stc__cryptolite__context__rsa__t.html">cy_stc_cryptolite_context_rsa_t</a> rsa_ctx;</div><div class="line">    <a class="code" href="structcy__stc__cryptolite__context__sha256__t.html">cy_stc_cryptolite_context_sha256_t</a> sha_ctx;</div><div class="line">    <a class="code" href="group__group__cryptolite__enums.html#gafc6e4a5cca26d2fe19ba6d8c3429a4df">cy_en_cryptolite_sig_verify_result_t</a> verResult;</div><div class="line">    <a class="code" href="group__group__cryptolite__enums.html#gafaeb3f2fb88784222220aee907e36710">cy_en_cryptolite_status_t</a> status;</div><div class="line"></div><div class="line">    verResult = <a class="code" href="group__group__cryptolite__enums.html#ggafc6e4a5cca26d2fe19ba6d8c3429a4dfa353581c237f64d4bdceb04a44b156cd0">CY_CRYPTOLITE_SIG_INVALID</a>;</div><div class="line">    memset((<span class="keywordtype">void</span>*)&amp;decryptedSignature, 0u, <span class="keyword">sizeof</span>(decryptedSignature));</div><div class="line">    memset((<span class="keywordtype">void</span>*)&amp;calculatedHash, 0u, <span class="keyword">sizeof</span>(calculatedHash));</div><div class="line">    memset((<span class="keywordtype">void</span>*)&amp;rsa_buffer, 0u, <span class="keyword">sizeof</span>(rsa_buffer));</div><div class="line">    memset((<span class="keywordtype">void</span>*)&amp;rsa_ctx, 0u, <span class="keyword">sizeof</span>(rsa_ctx));</div><div class="line">    memset((<span class="keywordtype">void</span>*)&amp;sha_ctx, 0u, <span class="keyword">sizeof</span>(sha_ctx));</div><div class="line"></div><div class="line">    Cy_Cryptolite_InvertEndianness(modulus_2048, 2048u/8 );</div><div class="line">    Cy_Cryptolite_InvertEndianness(encryptedSignature_2048, <span class="keyword">sizeof</span>(encryptedSignature_2048) );</div><div class="line"></div><div class="line">    Cy_Cryptolite_InvertEndianness(publicExponent, <span class="keyword">sizeof</span>(publicExponent));</div><div class="line"></div><div class="line">    <a class="code" href="structcy__stc__cryptolite__rsa__pub__key__t.html">cy_stc_cryptolite_rsa_pub_key_t</a> pubKeyPtr =</div><div class="line">    {</div><div class="line">        .<a class="code" href="structcy__stc__cryptolite__rsa__pub__key__t.html#af693adcbc706181816a873bf82107f87">moduloPtr</a>          = modulus_2048,</div><div class="line">        .moduloLength       = 2048u,</div><div class="line">        .pubExpPtr          = publicExponent,</div><div class="line">        .pubExpLength       = <span class="keyword">sizeof</span>(publicExponent)* 8,       <span class="comment">/* 17 bits */</span></div><div class="line">        .barretCoefPtr       = barretCoef,</div><div class="line">        .inverseModuloPtr    = inverseModulo,</div><div class="line">        .rBarPtr             = rBar,</div><div class="line">        .preCalculatedCoeff  = <span class="keyword">false</span></div><div class="line">    };</div><div class="line"></div><div class="line">    status = <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga9e98470af0fe0cd1150107725e79faff">Cy_Cryptolite_Rsa_Init</a>(CRYPTOLITE, &amp;rsa_ctx, &amp;rsa_buffer);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div><div class="line">    <span class="comment">/* At first decrypt the received signature. */</span></div><div class="line">    status = <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga935311182a513548ec08fe3602a61145">Cy_Cryptolite_Rsa_Proc</a>(CRYPTOLITE, &amp;rsa_ctx, &amp;pubKeyPtr, encryptedSignature_2048, 2048u, decryptedSignature);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div><div class="line">    <span class="comment">/* Calculate the hash from the plain text */</span></div><div class="line">    status = <a class="code" href="group__group__cryptolite__lld__sha__functions.html#gaf75a1097e529cb20c9ef8d04f5ccb083">Cy_Cryptolite_Sha256_Run</a>(CRYPTOLITE, plainTxt, <span class="keyword">sizeof</span>(plainTxt)-1, calculatedHash, &amp;sha_ctx);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div><div class="line">    Cy_Cryptolite_InvertEndianness(decryptedSignature, <span class="keyword">sizeof</span>(encryptedSignature_2048));</div><div class="line"></div><div class="line">    <span class="comment">/* Finally verify decrypted signature with calculated digest */</span></div><div class="line">    status = <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#ga30e087a8a09210e4bf99aefdf5ade151">Cy_Cryptolite_Rsa_Verify</a>(CRYPTOLITE, &amp;rsa_ctx, &amp;verResult, <a class="code" href="group__group__cryptolite__enums.html#gga9dfc40ba7980b0b0d82fcd4ceef4647fa221a4c64dac27b8fa96d4a539d900ce4">CY_CRYPTOLITE_MODE_SHA256</a>, calculatedHash, <span class="keyword">sizeof</span>(calculatedHash), decryptedSignature, <span class="keyword">sizeof</span>(encryptedSignature_2048));</div><div class="line"></div><div class="line">    <span class="comment">/* ... check for errors... */</span></div><div class="line"></div><div class="line">    <a class="code" href="group__group__cryptolite__lld__asymmetric__functions.html#gad9679d4c527d03c5dc1e2f4f8476ca16">Cy_Cryptolite_Rsa_Free</a>(CRYPTOLITE, &amp;rsa_ctx);</div><div class="line"></div><div class="line">    <span class="comment">/* ... check verResult is CY_CRYPTOLITE_SIG_VALID... */</span></div><div class="line"></div></div><!-- fragment --></dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>MTB CAT1 Peripheral driver library</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
